Giter Site home page Giter Site logo

Improve compile times about uom HOT 6 CLOSED

iliekturtles avatar iliekturtles commented on September 13, 2024
Improve compile times

from uom.

Comments (6)

iliekturtles avatar iliekturtles commented on September 13, 2024 5

I pushed 224db41 recently that makes a big dent in the problem! The issue is related to private type aliases of public types. Making the type alias public cuts a clean build with --all-features from 1137.24 s down to 28.68 s on one of my machines! A build with default features goes from 25.94 s to 5.73 s.

I did eventually get cargo bloat running after some technical delays and and the results seem to show that uom, at least for the si example, is fully inlined: https://gist.github.com/iliekturtles/474e950b544c268d3c600567f0f60bd8.

I'm leaving the issue open for the moment as I want to submit a report upstream.

from uom.

iliekturtles avatar iliekturtles commented on September 13, 2024 1

Initial investigation shows that the storage_types! calls in quantity! that add $crate::Conversion<V> and super::Conversion<V> impl blocks are the culprit. Commenting out these impls makes compilation significantly faster.

from uom.

iliekturtles avatar iliekturtles commented on September 13, 2024 1

I'm pretty sure macro recursion isn't the issue, but reviewing the output of cargo bloat is a good idea!

from uom.

juleskers avatar juleskers commented on September 13, 2024

(Hi from the 'what are you up to this week' thread)

Maybe this blogpost about claps weight-reduction can help?
https://clap.rs/2018/01/09/new-years-weight-loss/ (sorry, the title sounds a bit spammy)
This uses the excellent cargo bloat), which helped kbknapp see where his macros where unexpectedly recursing, and some refactoring brought down the total code size (and thus, compile time).

Admittedly, the blog is mostly about binary size, but on the assumption that "more generated code == more compile time", it might pay to have a look.

from uom.

juleskers avatar juleskers commented on September 13, 2024

Yeah, from the issue description, and the mostly linear time relation with the number of enabled features (excellent benchmark, b.t.w.), it's probably just the linear amount of complex implementations.

But who knows, maybe bloat can help you identify some potential optimisations in those traits. :-)

from uom.

iliekturtles avatar iliekturtles commented on September 13, 2024

Closing this issue. Upstream issue triaged and current uom compile times are reasonable.

from uom.

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.