Skip to content
Snippets Groups Projects
  1. Feb 10, 2025
  2. Feb 08, 2025
  3. Feb 06, 2025
    • Matthew Pickering's avatar
      perf: Key the interpreter symbol cache by Name rather than FastString · f71c2835
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Profiles showed that about 0.2s was being spend constructing the keys
      before looking up values in the old symbol cache.
      
      The performance of this codepath is critical as it translates directly
      to a delay when a user evaluates a function like `main` in the
      interpreter.
      
      Therefore we implement a solution which keys the cache(s) by `Name`
      rather than the symbol directly, so the cache can be consulted before
      the symbol is constructed.
      
      Fixes #25731
      f71c2835
    • Matthew Pickering's avatar
      interpreter: Fix INTERP_STATS profiling code · 66c7f656
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      The profiling code had slightly bitrotted since the last time it was
      used. This just fixes things so that if you toggle the INTERP_STATS
      macro then it just works and prints out the stats.
      
      Fixes #25695
      66c7f656
    • Matthew Pickering's avatar
      perf: nameToCLabel: Directly manipulate ByteString rather than going via strings · 5622a14a
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      `nameToCLabel` is called from `lookupHsSymbol` many times during
      bytecode linking. We can save a lot of allocations and time by directly
      manipulating the bytestrings rather than going via intermediate lists.
      
      Before: 2GB allocation, 1.11s
      After: 260MB allocation, 375ms
      
      Fixes #25719
      
      -------------------------
      Metric Decrease:
          MultiLayerModulesTH_OneShot
      -------------------------
      5622a14a
    • Matthew Pickering's avatar
      perf: Replace uses of genericLength with strictGenericLength · db19c8a9
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      genericLength is a recursive function and marked NOINLINE. It is not
      going to specialise. In profiles, it can be seen that 3% of total compilation
      time when computing bytecode is spend calling this non-specialised
      function.
      
      In addition, we can simplify `addListToSS` to avoid traversing the input
      list twice and also allocating an intermediate list (after the call to
      reverse).
      
      Overall these changes reduce the time spend in 'assembleBCOs' from 5.61s
      to 3.88s. Allocations drop from 8GB to 5.3G.
      
      Fixes #25706
      db19c8a9
  4. Feb 04, 2025
  5. Feb 03, 2025
    • Peter Trommler's avatar
      RTS: Fix compile on powerpc64 ELF v1 · 05e5785a
      Peter Trommler authored and Marge Bot's avatar Marge Bot committed
      Cabal does not know about the different ABIs for powerpc64 and compiles
      StgCRunAsm.S unconditionally. The old make-based build system excluded
      this file from the build and it was OK to signal an error when it was
      compiled accidentally.
      
      With this patch we compile StgCRunAsm.S to an empty file, which fixes
      the build.
      
      Fixes #25700
      05e5785a
    • Matthew Pickering's avatar
      compiler: Always load GHC.Data.FastString optimised into GHCi · 662645f0
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      The FastString table is shared between the boot compiler and interpreted
      compiler. Therefore it's very important the representation of
      `FastString` matches in both cases. Otherwise, the interpreter will read
      a FastString from the shared variable but place the fields in the wrong
      place which leads to segfaults.
      
      Ideally this state would not be shared, but for now we can always
      compile both with `-O2` and this leads to a working interpreter.
      662645f0
  6. Jan 30, 2025
  7. Jan 29, 2025
Loading