René's URL Explorer Experiment


Title: feat: add caching to routing header calculation by daniel-sanche · Pull Request #526 · googleapis/python-api-core · GitHub

Open Graph Title: feat: add caching to routing header calculation by daniel-sanche · Pull Request #526 · googleapis/python-api-core

X Title: feat: add caching to routing header calculation by daniel-sanche · Pull Request #526 · googleapis/python-api-core

Description: _to_grpc_metadata is used to convert a tuple of string metadata into the proper GCP routing format. It is part of the hot-path of rpcs with routing info, and it adds a noticable cost to each rpc. But typically, the same values will be used for each rpc This PR adds a functools.lru_cache wrapper, to memoize the most recent paramaters used import timeit import functools from google.api_core.gapic_v1.routing_header import to_grpc_metadata metadata = (("table_name", "projects/p/tables/my-table"),) result = timeit.timeit(lambda: to_grpc_metadata(metadata)) print(f"orig time: {result:0.2f}") cached_to_metadata = functools.lru_cache(to_grpc_metadata) result = timeit.timeit(lambda: cached_to_metadata(metadata)) print(f"cached time: {result:0.2f}") orig time: 1.19 cached time: 0.07

Open Graph Description: _to_grpc_metadata is used to convert a tuple of string metadata into the proper GCP routing format. It is part of the hot-path of rpcs with routing info, and it adds a noticable cost to each rpc. ...

X Description: _to_grpc_metadata is used to convert a tuple of string metadata into the proper GCP routing format. It is part of the hot-path of rpcs with routing info, and it adds a noticable cost to each rpc. ...

Opengraph URL: https://github.com/googleapis/python-api-core/pull/526

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ed0ea321-7359-85cc-c5d0-e5c6e9a6bf70
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idBF22:AC7DC:BAFDC3:1107DDD:6A4E23A9
html-safe-noncebd10cc553eafa809a9abb619b4bc2c4c01db66f55041c66789cb553685d38ff7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjIyOkFDN0RDOkJBRkRDMzoxMTA3REREOjZBNEUyM0E5IiwidmlzaXRvcl9pZCI6IjQ2NTk3OTUxODU4NDM5NzA5ODUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7f58fe3f7615b0bec1aff5c09716166b87102ad1507e2ffdd552feb62af6dd3d
hovercard-subject-tagpull_request:1505383744
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/googleapis/python-api-core/pull/526/files
twitter:imagehttps://avatars.githubusercontent.com/u/3914119?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3914119?s=400&v=4
og:image:alt_to_grpc_metadata is used to convert a tuple of string metadata into the proper GCP routing format. It is part of the hot-path of rpcs with routing info, and it adds a noticable cost to each rpc. ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/googleapis/python-api-core git https://github.com/googleapis/python-api-core.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id226992456
octolytics-dimension-repository_nwogoogleapis/python-api-core
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id226992456
octolytics-dimension-repository_network_root_nwogoogleapis/python-api-core
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
release5fe497b4815fcce3df76c0e246faa739a82c3124
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/python-api-core/pull/526/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-api-core%2Fpull%2F526%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-api-core%2Fpull%2F526%2Ffiles
Sign up https://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=googleapis%2Fpython-api-core
Reloadhttps://github.com/googleapis/python-api-core/pull/526/files
Reloadhttps://github.com/googleapis/python-api-core/pull/526/files
Reloadhttps://github.com/googleapis/python-api-core/pull/526/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/526/files
googleapis https://github.com/googleapis
python-api-corehttps://github.com/googleapis/python-api-core
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Fork 97 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Star 144 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-api-core
Code https://github.com/googleapis/python-api-core
Issues 0 https://github.com/googleapis/python-api-core/issues
Pull requests 0 https://github.com/googleapis/python-api-core/pulls
Actions https://github.com/googleapis/python-api-core/actions
Projects https://github.com/googleapis/python-api-core/projects
Security and quality 0 https://github.com/googleapis/python-api-core/security
Insights https://github.com/googleapis/python-api-core/pulse
Code https://github.com/googleapis/python-api-core
Issues https://github.com/googleapis/python-api-core/issues
Pull requests https://github.com/googleapis/python-api-core/pulls
Actions https://github.com/googleapis/python-api-core/actions
Projects https://github.com/googleapis/python-api-core/projects
Security and quality https://github.com/googleapis/python-api-core/security
Insights https://github.com/googleapis/python-api-core/pulse
daniel-sanchehttps://github.com/daniel-sanche
mainhttps://github.com/googleapis/python-api-core/tree/main
routing-header-cachehttps://github.com/googleapis/python-api-core/tree/routing-header-cache
Conversation 6 https://github.com/googleapis/python-api-core/pull/526
Commits 15 https://github.com/googleapis/python-api-core/pull/526/commits
Checks 0 https://github.com/googleapis/python-api-core/pull/526/checks
Files changed https://github.com/googleapis/python-api-core/pull/526/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/526/files
feat: add caching to routing header calculation https://github.com/googleapis/python-api-core/pull/526/files#top
Show all changes 15 commits https://github.com/googleapis/python-api-core/pull/526/files
30189ea feat: add caching to routing header daniel-sanche Sep 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/30189eaa1fc4689b5bfefb682add0faa56555672
9ae434c added constant for cache size daniel-sanche Sep 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/9ae434cfa1469f5c1aba4872e6861d3993b1ecf3
cf34a3a Merge branch 'main' into routing-header-cache daniel-sanche Sep 19, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/cf34a3a316502e73e9180d2e2b0a518c2e6bdda5
2eb47ff Merge branch 'main' into routing-header-cache daniel-sanche Oct 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/2eb47ff8fe620b0db85c7dac0bf45d64ce0e622d
deb13c3 moved cacheing into helper daniel-sanche Oct 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/deb13c3608c8831dfbc947986724f0d8bcf00782
6d7c807 cache individual components daniel-sanche Oct 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/6d7c8079218bda43594a59bce7298bea41c97780
a2e7575 added tests daniel-sanche Oct 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/a2e7575efeea25520d2b0c32761f07bddc317588
651adb9 ran blacken daniel-sanche Oct 6, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/651adb9d821081ed731cfe6d81f1964e07d7deba
58d911d Update test name daniel-sanche Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/58d911d5a1fb745ee7f0e67f0825ab167ba1e407
916164f add comment daniel-sanche Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/916164f5acd7a32f27a0cce204457367b501bef9
232148a improve comments daniel-sanche Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/232148a8c0130b48fc92e29867aa9ca921901331
3873e2c moved comment daniel-sanche Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/3873e2cd35da03dd8d379de671c6b924cb319e01
27b1747 Merge branch 'main' into routing-header-cache daniel-sanche Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/27b1747b9a022f6ecb0373f5bfda4e3fa4ef64af
2f65050 🦉 Updates from OwlBot post-processor gcf-owl-bot[bot] Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/2f65050583d8a6d5971147dbaad60a6e936694e6
5a6afd5 🦉 Updates from OwlBot post-processor gcf-owl-bot[bot] Oct 9, 2023 https://github.com/googleapis/python-api-core/pull/526/commits/5a6afd5cd3c047d07b1f89286f5918823469245a
Clear filters https://github.com/googleapis/python-api-core/pull/526/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/526/files
Please reload this pagehttps://github.com/googleapis/python-api-core/pull/526/files
routing_header.py https://github.com/googleapis/python-api-core/pull/526/files#diff-a2c5eba1d391f81560683d8833d90c7729ffb1dd4b060ec5eabda5f0deedc37e
test_routing_header.py https://github.com/googleapis/python-api-core/pull/526/files#diff-95fcb8e7c734032ed4bbab559b80ed07b2fdca17fdca14faf5d5eba896070250
google/api_core/gapic_v1/routing_header.pyhttps://github.com/googleapis/python-api-core/pull/526/files#diff-a2c5eba1d391f81560683d8833d90c7729ffb1dd4b060ec5eabda5f0deedc37e
View file https://github.com/googleapis/python-api-core/blob/5a6afd5cd3c047d07b1f89286f5918823469245a/google/api_core/gapic_v1/routing_header.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/526/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/526/files#diff-a2c5eba1d391f81560683d8833d90c7729ffb1dd4b060ec5eabda5f0deedc37e
https://github.com/googleapis/python-api-core/pull/526/files#diff-a2c5eba1d391f81560683d8833d90c7729ffb1dd4b060ec5eabda5f0deedc37e
tests/unit/gapic/test_routing_header.pyhttps://github.com/googleapis/python-api-core/pull/526/files#diff-95fcb8e7c734032ed4bbab559b80ed07b2fdca17fdca14faf5d5eba896070250
View file https://github.com/googleapis/python-api-core/blob/5a6afd5cd3c047d07b1f89286f5918823469245a/tests/unit/gapic/test_routing_header.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/googleapis/python-api-core/pull/526/{{ revealButtonHref }}
https://github.com/googleapis/python-api-core/pull/526/files#diff-95fcb8e7c734032ed4bbab559b80ed07b2fdca17fdca14faf5d5eba896070250
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.