-
Notifications
You must be signed in to change notification settings - Fork 30.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
bitfields? #29126
Comments
e.g. readable state from 23 (184 bytes?): objectMode
highWaterMark
buffer
length
pipes
flowing
ended
endEmitted
reading
sync
needReadable
emittedReadable
readableListening
resumeScheduled
paused
emitClose
autoDestroy
destroyed
defaultEncoding
awaitDrain
decoder
encoding
endEmitted to 9 (72 byttes? almost fits in cacheline): bitfield
highWaterMark
buffer
length
pipes
defaultEncoding
awaitDrain
decoder
encoding |
Yes. Would you be interested in opening a PR and seeing how the benchmarks go? |
@addaleax: So from my research it seems the performance improvements are small (0-10%) and some cognitive overhead is involved. The only reason this might be worth looking into is to reduce memory usage (which can be relevant for e.g. http). Should we close this? |
Is there any reason why bitfields are not used more in NodeJS?
e.g. the readable and writable state footprint can easily be reduced by more than 50% by switching all of those different boolean flags into a single 16/32 bit bitfield. Reducing memory usage and improving CPU cache access.
Is this something worth investigating?
The text was updated successfully, but these errors were encountered: