Live data from Hacker News

Mold: A Modern Linker

github.com

61–70 of 125 posts

Re: Mold: A Modern Linker

#62
post #60
post #52

Earlier quoted context omitted.

I chose mmap based on benchmarking. Writing a 2 GiB memory buffer to a file using write(2) was slower than directly constructing file contents to mmap'ed memory region. What is more interesting is the real bottleneck was not about mmap vs write(v) but in the filesystem. If you create a fresh file and write 2 GiB of data to that file, it takes like 700 milliseconds on my machine (ext4 fs), but if you write the same am…

> So, the filesystem's performance to allocate new disk blocks seems to limit the performance of my linker. If you know the total size ahead of time, you might try using fallocate(2).

I actually tried fallocate(2) but it didn't change the performance characteristics at all. It doesn't seem to do what its man page says.

Re: Mold: A Modern Linker

#63
Yes!!!! This is excellent tool engineering, choosing the right target and setting a high but attainable target which fundamentally drives the design. I love the idea that `mold` "competes" with `cat`. That right there is genius framing of the problem.

Re: Mold: A Modern Linker

#64
post #18
post #13

From a marketing perspective, "mold" meaning "a form used to cast an object from liquid" is a lot more appealing than "green fungus growing on bread." A mold for casting objects is also a lot closer, metaphorically speaking, to what a linker does. I honestly thought that was the meaning the author was trying to evoke before I saw the picture on the github page.

Author here. Haha, that's perhaps true. But at the same time, it seems like a tradition to give a silly name (e.g. "git") to a tool, and I actually like that name and the image to show that I'm not too serious. This is a fun project but not ready for production use.

Sounds like you just need a multi-bump cake/jello mold like [1] with multiple "input spigots" pouring in with a "fast harden" aspect to have the perfect logo/name combo. Not sure how to convey rapid hardening with simple art, though... :-)

EDIT: You may just have to settle for speed/parallelism being conveyed by 2..3 spigots pouring in. :-) It's perfect - you can stay with moldy bread while it is a major work in progress and evolve to the more finished logo when your own work is "hardened" -- all without changing the name. ;-)

[1] https://www.foodandwine.com/cooking-techniques/baking/best-b...

Re: Mold: A Modern Linker

#65

Earlier quoted context omitted.

Would emulsifier roll off the tongue better?

It would likely get shortened to emu, and then we would all be wondering if it's an emulator or a large bird.

Also, everybody in australia would be leery of using it lest it win a war against them again.

Re: Mold: A Modern Linker

#66
post #62
post #60

Earlier quoted context omitted.

> So, the filesystem's performance to allocate new disk blocks seems to limit the performance of my linker. If you know the total size ahead of time, you might try using fallocate(2).

I actually tried fallocate(2) but it didn't change the performance characteristics at all. It doesn't seem to do what its man page says.

I wonder if that's filesystem/OS dependent.

Re: Mold: A Modern Linker

#68
post #67

I’m surprised by the statement that ‘cat’ is slow because it’s not multithreaded. Isn’t ‘cat’ io-bound?

I think his point is that you can match `cat`s speed because it is IO bound and you can make a linker IO bound by using lots of threads.

Re: Mold: A Modern Linker

#69

I wonder how rui314's assertion that incremental linking is a poor tradeoff squares with Zig's decision[1] to build its own linker with "in-place binary patching". I assume part of the difference is that Zig has complete control over its environment, whereas Mold is trying to be a general-purpose linker, but still, I wonder if there's some insight to be gained from crosspollination there. (like, maybe Mold could have…

Zig's compiler isn't optimizing for linking speed over everything else though AFAIK. Also, Andrew says in the thread[0] that the linker doesn't (yet) address the types of complex scenarios that rui talks about.

[0] https://github.com/ziglang/zig/issues/1535#issuecomment-6784...

Post reply on HN