-
Notifications
You must be signed in to change notification settings - Fork 37.8k
compressor: use a prevector in CompressScript serialization [ZAP1] #18847
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
There's also a call in bitcoin/src/test/fuzz/script.cpp Lines 39 to 40 in 844d207
|
Any reason not to do this for decompression? |
nope, I could do that as well. |
3ac60ed
to
14cd3d9
Compare
0616c3d
to
d03a694
Compare
b782989
to
98c0688
Compare
Can you explain where 33 comes from?
oh yeah good idea
|
30834be
to
6183bda
Compare
Use a prevector for stack allocation instead of heap allocation during script compression and decompression. These functions were doing millions of unnecessary heap allocations during IBD. We introduce a CompressedScript type alias for this prevector. It is size 33 as that is the maximum size of a compressed script. Fix the DecompressScript header to match the variable name from compressor.cpp Signed-off-by: William Casarin <jb55@jb55.com>
6183bda
to
83a425d
Compare
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
ACK 83a425d |
tACK 83a425d |
doing some tests I'm seeing a very tiny improvement in tmpfs/memdisk reindex up to height 200k: but could just be luck 🤷 would be interesting to test this to even higher heights.
I also traced the number of calls to CompressScript: around I used
|
friendly yearly bump |
utACK 83a425d |
This function was doing millions of unnecessary heap allocations during IBD.
I'm start to catalog unnecessary heap allocations as a pet project of mine: as-zero-as-possible-alloc IBD. This is one small step.
before:

after:

should I type alias this?I type aliased itThis is a part of the Zero Allocations Project #18849 (ZAP1). This code came up as a place where many allocations occur.