Coder Social home page Coder Social logo

Comments (8)

nitsky avatar nitsky commented on July 18, 2024 1

@rui314 thanks for the explanation, I clearly misunderstood how preloading is implemented in mold. This will not work with cargo because cargo does not allow the user to access the list of object files prior to linking.

Ideally, mold would have a feature like this:

If I run mold -daemon -o output a.o b.o c.o, mold detects that no daemon is running, starts one up, and performs the first link.
Now, I can run mold -daemon -o output a.o b.o c.o any number of times, and each time mold detects that the daemon is running and the arguments are the same, so it reuses work from the first invocation.

Is this possible? I am not an expert on linking, so I don't know what the limitations are.

Thank you!

from mold.

rui314 avatar rui314 commented on July 18, 2024

Thank you for your suggestion, but I think there are a few practical issues with that approach:

  • Preloading is supposed to be used in preload object files, compile, link cycles. So, in a single build (e.g. a single invocation of make or cargo), you are supposed to first run mold with -reload, compile source, and then invoke mold again without -preload. Can you make a change to cargo config to do this in the first place?
  • If we allow the exact same command line flags, every number of mold run does preload, and every odd number of mold run creates an output. I think it can easily be out of sync and confuses build systems and users.

from mold.

rui314 avatar rui314 commented on July 18, 2024

The preloading feature can make mold faster, but mold is already pretty fast. Could you share a little bit more about why you wanted to use the preloading feature? How long does your build takes for the linking step?

from mold.

vi avatar vi commented on July 18, 2024

why you wanted to use the preloading feature?

To move from "1.69s" in "mold" column in README to "0.79s" in "mold w/ preloading"?

from mold.

gilescope avatar gilescope commented on July 18, 2024

If you're using mold --run then that would know when it had started for the first time and could do the --preload and then subsequent mold calls could make use of that for the lifetime that the mold --run is running. I.e. it could act as a short-term daemon. (That said maybe I too have misunderstood)

from mold.

rui314 avatar rui314 commented on July 18, 2024

When mold started as mold run make, it doesn't know the actual linker command. It only gets make as an argument. But we need a list of object files and other command line parameters to start preloading. So it is not feasible.

from mold.

gilescope avatar gilescope commented on July 18, 2024

from mold.

rui314 avatar rui314 commented on July 18, 2024

Object file preloading doesn't seem to get traction, and it looks to me that making that feature trickier/more implicit isn't a good idea, so I'll close this issue as working-as-intended.

from mold.

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.