4 ms·
I have "a thing" for basic system services like malloc, linker, etc. Writing a memory allocator is a nice exercise but it's also fundamental research: by toyin
by yason 12y ago
I have "a thing" for basic system services like malloc, linker, etc.
Writing a memory allocator is a nice exercise but it's also fundamental research: by toying around, because of sheer interest, with what everyone else takes for granted you might come up with something that changes things for all, big time.
For example, memory allocators were considered a "well enough solved" problem for a long time until suddenly we had a rush of new, experimental, and/or optimized allocators like jemalloc, tcmalloc etc. While they might not be revolutionary they still blast the old 80's/90's implementations like no tomorrow.
- Animats 12y agoLinkers don't get as much attention as they should. The linker has the last chance to look at the entire program before it runs. It's a good place for final checks and optimizations. In Modula, each module had an "init" section. The Modula linker traced the dependencies of the "init" sections and arranged for them to be executed in a valid order. If there was a dependency loop, that was an error. That's way ahead of the C/C++ rules on order of initialization. Elimination of duplicate code at link time is possible. For template and generic instantiations, this can be a big win, especially for C++. Some linkers support "weak links" - if A has a weak link to B, and there are no strong links to B, B is not loaded and the link is null. This is useful for optional components which need some kind of startup.
- vegedor 12y agoGCC with --flto, literally link-time-optimizations, is new to me and seems to be good. It turns everything it can into constants, even inlines functions from pointer calls and resolves them if the arguments are also constant. That didn't work for me without it. Dunno if that's std compliant.
- nitrogen 12y agoVegedor, it looks like an early negative comment got your account auto-killed. Quoting dead comment: vegedor 17 hours ago | link [dead] GCC with --flto, literally link-time-optimizations, is new to me and seems to be good. It turns everything it can into constants, even inlines functions from pointer calls and resolves them if the arguments are also constant. That didn't work for me without it. Dunno if that's std compliant.
- drivers99 12y agoThat reminds me of something that the streamer for the Handmade Hero steam said on the Day 001 Q&A said about "reinventing the wheel".[1] https://www.youtube.com/watch?v=uxbJo5DDpWY&feature=player_detailpage#t=3540 https://www.youtube.com/watch?v=uxbJo5DDpWY&feature=player_d... Basically, a wheel is perfect. Nothing we have developed so far is a wheel. We should not stop trying to learn how to write these low level things, because these are the people that might come up with better things in the future.
- Narishma 12y ago[quote]While they might not be revolutionary they still blast the old 80's/90's implementations like no tomorrow.[/quote] But will they do so on 80's and 90's hardware?