-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use a heap for small sizes #1911
base: main
Are you sure you want to change the base?
Conversation
ca76c4a
to
ac5d5f0
Compare
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.
Nice!
Just to be clear the benefit in the first case comes from not inserting and removing to/from the residency set. And in the second case also from possibly faster de-/allocation of new buffers.
Presumably if benchmarked with <=256 instead of 4096 the difference would be even bigger in the second case.
Exactly, it turns out it's kind of expensive to add stuff to the residency set (it's mostly the committing / requesting residency which we do eagerly, as opposed to just adding it to the set).
Exactly. |
Do you think it makes sense to just do it once every N buffer creations? And simply make sure we have done it before running eval? |
I think there are some things to investigate there. But it's not entirely obvious if/what to optimize. The residency set in practice works like so:
|
Use a heap for small sizes until it is full. The heap size is 1MB which holds up to 4096 buffers which seems like a pretty reasonable number to start with.
A benchmark:
With:
Pre: 0.0332 s
Post: 0.0108 s
With:
Pre: 0.0935 s
Post: 0.0673 s