5 ms·
I once got quite a bit of startup time improvement by simply swapping out cpython's malloc calls for a version that took a large amount of resources at first (~
by jakear 6y ago
I once got quite a bit of startup time improvement by simply swapping out cpython's malloc calls for a version that took a large amount of resources at first (~5GB, can be tuned to your workload), and allocated from that. CPython makes many many thousands of mallocs at startup so this gave significant improvement.
- kirubakaran 6y agoCan you please share some numbers if you have them? How much improvement, etc.
- jakear 6y ago60% decrease in startup time, 10% improvement in general runtime. Of course if you exceed the initial allocation the whole thing will crash. That could probably be worked around with a bit more intelligence in the allocator. This was part of a class project so not available online unfortunately. It’s good practice to implement it yourself though! There are lots of resources online for implementing fast allocators.
- intrepidhero 6y agoThis is a really interesting approach. I'd love to hear more. Were you patching cpython then? Is your work online somewhere?
- jakear 6y agoSee sibling. But yes I patched cpython, it’s pretty easy to build yourself.