Improve OutBuffer's allocation strategy#12519
Conversation
|
Thanks for your pull request, @andralex! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#12519" |
There was a problem hiding this comment.
src/dmd/backend/cv8.d(141): Error: no property `writen` for type `dmd.backend.outbuf.Outbuffer*`
src/dmd/backend/cv8.d(142): Error: no property `writeByte` for type `dmd.backend.outbuf.Outbuffer*`
Not sure why it compiled for you locally, but private should not have been added to any of the member functions.
|
Great find! 👍 |
Heh, that explains a lot. I was building using the makefile and it seems dependencies are not tracked properly, Now I touch |
|
I took the liberty to remove some cruft as well. |
While tracking dmd's memory usage I noticed there are very many calls to
OutBuffer::enlarge, which in turn makes a ton of calls torealloc:Turns out the vast majority of these calls are with
buf is nulland many others deal with small sizes, unnecessarily makingreallocroundtrips.This improves the strategy to special-case frequent cases and to double the allocated size for small buffers. The result for the same build:
I also took the liberty to make a bunch of functions private. I have no idea why that works because some are actually used from client code. Why is that the case?