{"id":20103858,"url":"https://github.com/ancientlore/ctxmap","last_synced_at":"2026-06-05T06:31:35.877Z","repository":{"id":33676094,"uuid":"37328822","full_name":"ancientlore/ctxmap","owner":"ancientlore","description":"Package ctxmap implements a registry for global context.Context for use in web applications.","archived":false,"fork":false,"pushed_at":"2023-02-04T16:46:50.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T04:42:28.002Z","etag":null,"topics":["context","golang"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ancientlore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-12T15:14:27.000Z","updated_at":"2021-12-08T20:00:00.000Z","dependencies_parsed_at":"2024-06-20T17:22:46.207Z","dependency_job_id":"4ef837cc-3857-4724-987d-1de2ef7a9ef1","html_url":"https://github.com/ancientlore/ctxmap","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ancientlore%2Fctxmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ancientlore%2Fctxmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ancientlore%2Fctxmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ancientlore%2Fctxmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ancientlore","download_url":"https://codeload.github.com/ancientlore/ctxmap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241543428,"owners_count":19979532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["context","golang"],"created_at":"2024-11-13T17:38:52.654Z","updated_at":"2026-06-05T06:31:35.870Z","avatar_url":"https://github.com/ancientlore.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"ctxmap\n=======\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/ancientlore/ctxmap.svg)](https://pkg.go.dev/github.com/ancientlore/ctxmap)\n\nPackage ctxmap implements a registry for global context.Context for use in web applications.\n\nBased on work from github.com/gorilla/context, this package simplifies the storage by mapping\na pointer to an http.Request to a context.Context. This allows applications to use Google's\nstandard context mechanism to pass state around their web applications, while sticking to\nthe standard http.HandlerFunc implementation for their middleware implementations.\n\nAs a result of the simplification, the runtime overhead of the package is reduced by 35 to 50\npercent in my tests. However, it would be common to store a map of values or a pointer to\na structure in the Context object, and my testing does not account for time taken beyond\ncalling Context.Value().\n\n| Benchmark                    | Readers | Writers | Iterations | Map Ops | context   | ctxmap    |\n|:-----------------------------|--------:|--------:|-----------:|--------:|----------:|----------:|\n| BenchmarkMutexSameReadWrite1 | 1       | 1       | 32         | 64      | 208.91 ns | 102.63 ns |\n| BenchmarkMutexSameReadWrite2 | 2       | 2       | 32         | 128     | 211.27 ns | 103.97 ns |\n| BenchmarkMutexSameReadWrite4 | 4       | 4       | 32         | 256     | 216.21 ns | 101.54 ns |\n| BenchmarkMutex1              | 2       | 8       | 32         | 320     | 252.26 ns | 92.62 ns  |\n| BenchmarkMutex2              | 16      | 4       | 64         | 1280    | 166.85 ns | 108.31 ns |\n| BenchmarkMutex3              | 1       | 2       | 128        | 384     | 221.67 ns | 78.47 ns  |\n| BenchmarkMutex4              | 128     | 32      | 256        | 40960   | 179.70 ns | 107.31 ns |\n| BenchmarkMutex5              | 1024    | 2048    | 64         | 196608  | 233.41 ns | 90.10 ns  |\n| BenchmarkMutex6              | 2048    | 1024    | 512        | 1572864 | 183.25 ns | 92.33 ns  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fancientlore%2Fctxmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fancientlore%2Fctxmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fancientlore%2Fctxmap/lists"}