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

[refactor] - base64 decoder #3762

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

[refactor] - base64 decoder #3762

wants to merge 6 commits into from

Conversation

ahrav
Copy link
Collaborator

@ahrav ahrav commented Dec 11, 2024

Description:

This PR refactors the base64 decoder. During the investigation of a client-reported CPU usage issue, profiling revealed that base64 decoding accounted for about ~6 seconds in a 30-second profile. The change required relatively low effort but delivers noticeable improvements.

Benchmarks

Screenshot 2024-12-10 at 8 24 22 PM

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

}

func appendB64Substring(data []byte, start, count int, substrings []string, endChars string) []string {
substring := bytes.TrimLeft(data[start:start+count], endChars)
if idx := bytes.IndexByte(bytes.TrimRight(substring, endChars), '='); idx != -1 {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The logic for handling = within the middle of a string has been preserved.

@ahrav ahrav requested review from a team December 11, 2024 04:38
@ahrav ahrav marked this pull request as ready for review December 11, 2024 22:46
@ahrav ahrav requested review from a team as code owners December 11, 2024 22:46
rosecodym

This comment was marked as outdated.

@rosecodym rosecodym dismissed their stale review December 12, 2024 14:44

trying something

Copy link
Collaborator

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

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

holding this up for a synchronous conversation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants