Coder Social home page Coder Social logo

Comments (7)

turion avatar turion commented on June 10, 2024 1

The branch may serve as a starting point for further future optimizations, of which arrM is only one.

from dunai.

turion avatar turion commented on June 10, 2024 1

Further bisecting of all the possible inlines suggests that inlining arr is also a huge performance win.

from dunai.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024 1

Just a note: Issue #375 addressed the introduction of a benchmark. It will require discussion before making changes, but it may be worth seeing if those benchmarks, or how they are used, should be improved.

from dunai.

ivanperez-keera avatar ivanperez-keera commented on June 10, 2024

@turion thanks a lot for this very detailed report. I know it's a lot to ask on top of what you've already done, but would you be able to put together a small benchmark that shows the difference in terms of performance with one and the other?

from dunai.

turion avatar turion commented on June 10, 2024

Yes, I managed to find a benchmark using ListT that reproduces the issue, I believe. It's much more visible there because many MSFs are launched.

Reproduce with cabal run spaceleak --enable-profiling -- +RTS -hc -l-agu -i0.01 && eventlog2html spaceleak.eventlog on branch https://github.com/turion/dunai/tree/dev_spaceleak.

Library on branch develop, with benchmark added

89d4125 Adding spaceleak

image

Replaced arrM definition with direct implementation

110e026 Write out arrM

image

  • Huge performance win (time per tick is reduced a lot)
  • Peak memory usage reduced from 28 to 21 MB
  • Space leak still visible

Heavy inlining and strictification in many places (shotgun optimization)

11ba331 Inline many functions

image

  • Again huge performance win
  • Peak memory usage further reduced
  • Space leak still visible
  • Unclear yet which of the many optimizations had an effect, further research necessary

from dunai.

turion avatar turion commented on June 10, 2024

My current strategy to identify the minimal set of necessary changes is:

  1. Bisect on the profiling result until a commit is identified that improves performance
  2. Cherry-pick that commit onto a branch improvements
  3. Rebase the whole branch with all inlinings onto improvements
  4. Repeat until the performance improving commit is already on improvements

from dunai.

turion avatar turion commented on June 10, 2024

Trying the benchmarks briefly seems to show that these changes here have a significant impact on the benchmarks. I think it would be very helpful if we could plot benchmarks (+ error bars) for several commits to compare them.

from dunai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.