-
-
Notifications
You must be signed in to change notification settings - Fork 658
Improve OutBuffer's allocation strategy #12519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?