Skip to content
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

Remove one writer alloc #430

Merged
merged 1 commit into from
Apr 30, 2024
Merged

Remove one writer alloc #430

merged 1 commit into from
Apr 30, 2024

Conversation

wcampbell0x2a
Copy link
Collaborator

  • Remove allocation and force bit.len() < MAX_BITS_AMT like reader does
  • Speed up deku_write_bits by 20% on my machine

@wcampbell0x2a wcampbell0x2a added this to the 0.17.0 milestone Apr 20, 2024
Copy link

Benchmark for 3739f19

Click to view benchmark
Test Base PR %
deku_read_bits 1295.0±15.77ns 1312.4±11.43ns +1.34%
deku_read_byte 5.2±0.09ns 5.2±0.22ns 0.00%
deku_read_enum 2.5±0.07ns 2.5±0.07ns 0.00%
deku_read_vec 35.6±0.82ns 35.4±0.32ns -0.56%
deku_write_bits 186.9±5.06ns 157.3±3.62ns -15.84%
deku_write_byte 22.3±0.42ns 22.7±0.36ns +1.79%
deku_write_enum 20.8±0.34ns 21.1±0.21ns +1.44%
deku_write_vec 325.0±2.49ns 306.7±4.58ns -5.63%

@wcampbell0x2a wcampbell0x2a force-pushed the remove-one-writer-alloc branch from 011908d to e9d5742 Compare April 20, 2024 22:50
Copy link

Benchmark for e35d91b

Click to view benchmark
Test Base PR %
deku_read_bits 1281.1±11.27ns 1282.6±41.56ns +0.12%
deku_read_byte 5.2±0.04ns 15.9±0.02ns +205.77%
deku_read_enum 2.5±0.07ns 15.5±0.05ns +520.00%
deku_read_vec 35.3±0.44ns 44.6±1.82ns +26.35%
deku_write_bits 183.9±3.76ns 156.5±3.05ns -14.90%
deku_write_byte 22.4±0.42ns 22.6±0.49ns +0.89%
deku_write_enum 20.8±0.29ns 21.6±2.21ns +3.85%
deku_write_vec 295.6±4.91ns 306.8±6.20ns +3.79%

sharksforarms
sharksforarms previously approved these changes Apr 29, 2024
Copy link
Owner

@sharksforarms sharksforarms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@wcampbell0x2a wcampbell0x2a force-pushed the impl-writer-inline-read-bytes branch from 6c78f99 to 176383a Compare April 29, 2024 22:08
Base automatically changed from impl-writer-inline-read-bytes to master April 30, 2024 00:25
@wcampbell0x2a wcampbell0x2a dismissed sharksforarms’s stale review April 30, 2024 00:25

The base branch was changed.

* Remove allocation and force bit.len() < MAX_BITS_AMT like reader does
* Speed up deku_write_bits by 20% on my machine
@wcampbell0x2a wcampbell0x2a force-pushed the remove-one-writer-alloc branch from e9d5742 to 206fb04 Compare April 30, 2024 00:32
@wcampbell0x2a
Copy link
Collaborator Author

@sharksforarms another rebase!

Copy link

Benchmark for 46df092

Click to view benchmark
Test Base PR %
deku_read_bits 1191.5±12.81ns 1174.7±20.79ns -1.41%
deku_read_byte 5.2±0.09ns 5.2±0.12ns 0.00%
deku_read_enum 2.6±0.08ns 2.6±0.10ns 0.00%
deku_read_vec 35.6±0.42ns 35.1±0.71ns -1.40%
deku_write_bits 197.1±6.44ns 157.3±3.56ns -20.19%
deku_write_byte 22.3±0.38ns 22.0±0.26ns -1.35%
deku_write_enum 23.7±0.82ns 23.6±0.53ns -0.42%
deku_write_vec 318.2±4.26ns 287.3±2.51ns -9.71%

@wcampbell0x2a wcampbell0x2a merged commit ba76deb into master Apr 30, 2024
11 of 13 checks passed
@wcampbell0x2a wcampbell0x2a deleted the remove-one-writer-alloc branch April 30, 2024 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants