René's URL Explorer Experiment


Title: Reduce the number of object allocations on the decode/encode hotpath by ChristopherWirt · Pull Request #45 · IABTechLab/iabgpp-java · GitHub

Open Graph Title: Reduce the number of object allocations on the decode/encode hotpath by ChristopherWirt · Pull Request #45 · IABTechLab/iabgpp-java

X Title: Reduce the number of object allocations on the decode/encode hotpath by ChristopherWirt · Pull Request #45 · IABTechLab/iabgpp-java

Description: When profiling I noticed a large number of strings being generated from AbstractBase64UrlEncoder.decode(). I think this is mostly attributable to the string concatenation inside the various loops. To fix this I've switched to using a StringBuilder. This avoids new strings being allocated on each iteration. I've also removed the use of regular expressions to validate inputs these are also relatively expensive to be happening at such a low level of the code. For bitString validation I've used a simple char inspecting method. For base64 I just used the absence of it appearing in the REVERSE_DICT to indicate this is an invalid base64 string. Finally to reduce auto-boxing I switched to using a Char2IntOpenHashMap for holding the REVERSE_DICT. To do this I've had to import a 3rd party fast utils lib - which is a lightweight collection of optimised primitive collection types, useful in cases like this.

Open Graph Description: When profiling I noticed a large number of strings being generated from AbstractBase64UrlEncoder.decode(). I think this is mostly attributable to the string concatenation inside the various loops. ...

X Description: When profiling I noticed a large number of strings being generated from AbstractBase64UrlEncoder.decode(). I think this is mostly attributable to the string concatenation inside the various loops. ...

Opengraph URL: https://github.com/IABTechLab/iabgpp-java/pull/45

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:11685e04-1977-1539-349a-067bb4db0adf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD0DE:B97E2:112CCAE:183B1BE:6AF65E16
html-safe-nonce893d33ec1d0892345d914cac17099e180e7dbffd8865a5248937efce2ef8b4a6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMERFOkI5N0UyOjExMkNDQUU6MTgzQjFCRTo2QUY2NUUxNiIsInZpc2l0b3JfaWQiOiIzNTQ2OTAyMTY1NTMyNDIxMzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8e19acdf58ee540d4eb1ca69a18af952f38186e820fc1824a9a681e6cdf96b2b
hovercard-subject-tagpull_request:1712532618
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/IABTechLab/iabgpp-java/pull/45/files
twitter:imagehttps://avatars.githubusercontent.com/u/13150390?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/13150390?s=400&v=4
og:image:altWhen profiling I noticed a large number of strings being generated from AbstractBase64UrlEncoder.decode(). I think this is mostly attributable to the string concatenation inside the various loops. ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonefded9ab97d594702a6a4ebcef0ee4f94c91fb16da7c62cac91ee0125e9c2d58c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/IABTechLab/iabgpp-java git https://github.com/IABTechLab/iabgpp-java.git
octolytics-dimension-user_id82903538
octolytics-dimension-user_loginIABTechLab
octolytics-dimension-repository_id538620496
octolytics-dimension-repository_nwoIABTechLab/iabgpp-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id538620496
octolytics-dimension-repository_network_root_nwoIABTechLab/iabgpp-java
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release39cd7745159797c426e62ba2199c584d653d4b32
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/IABTechLab/iabgpp-java/pull/45/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIABTechLab%2Fiabgpp-java%2Fpull%2F45%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIABTechLab%2Fiabgpp-java%2Fpull%2F45%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=IABTechLab%2Fiabgpp-java
Reloadhttps://github.com/IABTechLab/iabgpp-java/pull/45/files
Reloadhttps://github.com/IABTechLab/iabgpp-java/pull/45/files
Reloadhttps://github.com/IABTechLab/iabgpp-java/pull/45/files
IABTechLabhttps://github.com/IABTechLab
iabgpp-javahttps://github.com/IABTechLab/iabgpp-java
Codehttps://github.com/IABTechLab/iabgpp-java
Issues13 (13)https://github.com/IABTechLab/iabgpp-java/issues
Pull requests4 (4)https://github.com/IABTechLab/iabgpp-java/pulls
Actionshttps://github.com/IABTechLab/iabgpp-java/actions
Projectshttps://github.com/IABTechLab/iabgpp-java/projects
Security and qualityhttps://github.com/IABTechLab/iabgpp-java/security
Insightshttps://github.com/IABTechLab/iabgpp-java/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FIABTechLab%2Fiabgpp-java%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FIABTechLab%2Fiabgpp-java%2Fissues%2Fnew%2Fchoose
ChristopherWirthttps://github.com/ChristopherWirt
IABTechLab:masterhttps://github.com/IABTechLab/iabgpp-java/tree/master
ChristopherWirt:cwirt/reduce-object-allocations-hot-pathhttps://github.com/ChristopherWirt/iabgpp-java/tree/cwirt/reduce-object-allocations-hot-path
Conversation 2 https://github.com/IABTechLab/iabgpp-java/pull/45
Commits 1 https://github.com/IABTechLab/iabgpp-java/pull/45/commits
Checks 0 https://github.com/IABTechLab/iabgpp-java/pull/45/checks
Files changed https://github.com/IABTechLab/iabgpp-java/pull/45/files
Please reload this pagehttps://github.com/IABTechLab/iabgpp-java/pull/45/files
Reduce the number of object allocations on the decode/encode hotpath https://github.com/IABTechLab/iabgpp-java/pull/45/files#top
Show all changes 1 commit https://github.com/IABTechLab/iabgpp-java/pull/45/files
00713ee Reduce the number of object allocations on the decode/encode hotpath ChristopherWirt Feb 5, 2024 https://github.com/IABTechLab/iabgpp-java/pull/45/commits/00713eeccb943132d5e0f6fc67787830cd517869
Clear filters https://github.com/IABTechLab/iabgpp-java/pull/45/files
Please reload this pagehttps://github.com/IABTechLab/iabgpp-java/pull/45/files
Please reload this pagehttps://github.com/IABTechLab/iabgpp-java/pull/45/files
pom.xml https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-9c3052cc989f76ef970a98b358a1f264f24478181bb5e8dda971cc72dc228728
AbstractBase64UrlEncoder.java https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-de61bb11da769f4a6b5ef738c65de738e06ca551a77d04ed9f8723b081f3c2c9
FixedIntegerEncoder.java https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-a73338d3d670d34b929548e8ce9d9b5f24d3720c824af8c2feb4f31504414c27
iabgpp-encoder/pom.xmlhttps://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-9c3052cc989f76ef970a98b358a1f264f24478181bb5e8dda971cc72dc228728
View file https://github.com/ChristopherWirt/iabgpp-java/blob/00713eeccb943132d5e0f6fc67787830cd517869/iabgpp-encoder/pom.xml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IABTechLab/iabgpp-java/pull/45/{{ revealButtonHref }}
https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-9c3052cc989f76ef970a98b358a1f264f24478181bb5e8dda971cc72dc228728
https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-9c3052cc989f76ef970a98b358a1f264f24478181bb5e8dda971cc72dc228728
https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-9c3052cc989f76ef970a98b358a1f264f24478181bb5e8dda971cc72dc228728
...-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.javahttps://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-de61bb11da769f4a6b5ef738c65de738e06ca551a77d04ed9f8723b081f3c2c9
View file https://github.com/ChristopherWirt/iabgpp-java/blob/00713eeccb943132d5e0f6fc67787830cd517869/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/AbstractBase64UrlEncoder.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IABTechLab/iabgpp-java/pull/45/{{ revealButtonHref }}
https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-de61bb11da769f4a6b5ef738c65de738e06ca551a77d04ed9f8723b081f3c2c9
https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-de61bb11da769f4a6b5ef738c65de738e06ca551a77d04ed9f8723b081f3c2c9
iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoder.javahttps://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-a73338d3d670d34b929548e8ce9d9b5f24d3720c824af8c2feb4f31504414c27
View file https://github.com/ChristopherWirt/iabgpp-java/blob/00713eeccb943132d5e0f6fc67787830cd517869/iabgpp-encoder/src/main/java/com/iab/gpp/encoder/datatype/encoder/FixedIntegerEncoder.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/IABTechLab/iabgpp-java/pull/45/{{ revealButtonHref }}
https://github.com/IABTechLab/iabgpp-java/pull/45/files#diff-a73338d3d670d34b929548e8ce9d9b5f24d3720c824af8c2feb4f31504414c27
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.