bearophile wrote:
Once people write large programs with D2, such experiments can become useful.
This is the last blog post of a short series where they try to speed up Mozilla
startup:
http://blog.mozilla.com/tglek/2010/05/27/startup-backward-constructors/
More about similar topics, older posts from the same blog:
http://blog.mozilla.com/tglek/2010/04/
This stuff has been well understood since at least the late 1980's, and is
perpetually forgotten and rediscovered. The "Segmentor" was a product (now
forgotten) that would optimize your windows code layout for fast loading 20
years ago. I know that Microsoft uses similar technology. Mozilla is way, way
behind.
The Digital Mars linker can accept linker scripts
http://www.digitalmars.com/ctg/ctgDefFiles.html where the layout of the
functions can be specified in the FUNCTIONS section. It's a pain to do this
manually, so the profiler http://www.digitalmars.com/ctg/trace.html will use
runtime profiling to generate this script.
It works for dmd, too.
I've worked out a design for the front end to do this automatically based on
static analysis, but haven't implemented it yet.