Skip to content

Conversation

@dwalluck
Copy link
Contributor

Don't bother partitioning array
Skip bytes already in the decode buffer

Don't bother partitioning array
Skip bytes already in the decode buffer
@dwalluck dwalluck force-pushed the byte-buffer-position branch from d993b3a to 1c021fe Compare March 19, 2025 20:44
@dwalluck dwalluck changed the title Improve performance of encode and decode fix: improve performance of encode and decode Mar 19, 2025
@dwalluck
Copy link
Contributor Author

Sorry for the over-engineering in the first place, but when I got around to running some actual JMH benchmarks, it was clear that we were losing performance likely due to having to read the array twice to try to write it back in chunks. So, just go back to writing one at a time.

There was a bug where decoding wrote the same bytes that were already there instead of just setting the position. For decode, we can continue to look for the first '%' since this doesn't require reading again, just starting at that position.

@jeremylong jeremylong merged commit 2d9c56b into package-url:master Mar 20, 2025
3 of 4 checks passed
@dwalluck dwalluck deleted the byte-buffer-position branch April 15, 2025 21:40
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