{"id":18737940,"url":"https://github.com/rocketlaunchr/go-pool","last_synced_at":"2026-02-16T23:06:07.187Z","repository":{"id":40379229,"uuid":"329498734","full_name":"rocketlaunchr/go-pool","owner":"rocketlaunchr","description":"A better Generic Pool (sync.Pool)","archived":false,"fork":false,"pushed_at":"2025-04-12T07:56:52.000Z","size":151,"stargazers_count":54,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T08:37:40.252Z","etag":null,"topics":["go","golang","pool","sync"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rocketlaunchr.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,"zenodo":null}},"created_at":"2021-01-14T03:38:50.000Z","updated_at":"2025-04-12T07:56:37.000Z","dependencies_parsed_at":"2025-04-12T08:29:13.951Z","dependency_job_id":"c16a7a40-1161-4d5a-ab3b-1d247ae9abc1","html_url":"https://github.com/rocketlaunchr/go-pool","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocketlaunchr%2Fgo-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocketlaunchr%2Fgo-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocketlaunchr%2Fgo-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocketlaunchr%2Fgo-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocketlaunchr","download_url":"https://codeload.github.com/rocketlaunchr/go-pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248621342,"owners_count":21134815,"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":["go","golang","pool","sync"],"created_at":"2024-11-07T15:27:29.465Z","updated_at":"2026-02-16T23:06:07.181Z","avatar_url":"https://github.com/rocketlaunchr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"right\"\u003e\n  ⭐ \u0026nbsp;\u0026nbsp;\u003cstrong\u003ethe project to show your appreciation.\u003c/strong\u003e :arrow_upper_right:\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg src=\"assets/logo.png\" alt=\"go-pool\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"right\"\u003e\n  \u003ca href=\"http://godoc.org/github.com/rocketlaunchr/go-pool\"\u003e\u003cimg src=\"http://godoc.org/github.com/rocketlaunchr/go-pool?status.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/rocketlaunchr/go-pool\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/rocketlaunchr/go-pool\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# A Generic sync.Pool  ![](https://img.shields.io/static/v1?label=%E2%9C%93\u0026message=Prod%20Ready\u0026labelColor=darkgreen\u0026color=green) \n\nThis package is a **thin** wrapper over the `Pool` provided by the `sync` package. The `Pool` is an essential package to obtain maximum performance. It does so by reducing memory allocations.\n\n## Extra Features\n\n- Invalidate an item from the Pool (so it never gets used again)\n- Set a maximum number of items for the Pool (Limit pool growth)\n- Return the number of items in the pool (idle and in-use)\n- Designed for concurrency\n- **Fully Generic**\n\n## When should I use a pool?\n\n\u003e If you frequently allocate many objects of the same type and you want to save some memory allocation and garbage allocation overhead — @jrv\n\nRead [How did I improve latency by 700% using sync.Pool](https://www.akshaydeo.com/blog/2017/12/23/How-did-I-improve-latency-by-700-percent-using-syncPool)\n\n## Example\n\n```go\nimport \"github.com/rocketlaunchr/go-pool\"\n\ntype X struct {}\n\npool := pool.New(func() *X {\n  return \u0026X{}\n}, 5) // maximum of 5 items can be borrowed at a time\n\nborrowed := pool.Borrow()\ndefer borrowed.Return()\n\n// Use item here or mark as invalid\nx := borrowed.Item() // Use Item of type: *X\nborrowed.MarkAsInvalid()\n```\n\nOther useful packages\n------------\n\n- [awesome-svelte](https://github.com/rocketlaunchr/awesome-svelte) - Resources for killing react\n- [dataframe-go](https://github.com/rocketlaunchr/dataframe-go) - Statistics and data manipulation\n- [dbq](https://github.com/rocketlaunchr/dbq) - Zero boilerplate database operations for Go\n- [electron-alert](https://github.com/rocketlaunchr/electron-alert) - SweetAlert2 for Electron Applications\n- [google-search](https://github.com/rocketlaunchr/google-search) - Scrape google search results\n- [igo](https://github.com/rocketlaunchr/igo) - A Go transpiler with cool new syntax such as fordefer (defer for for-loops)\n- [mysql-go](https://github.com/rocketlaunchr/mysql-go) - Properly cancel slow MySQL queries\n- [react](https://github.com/rocketlaunchr/react) - Build front end applications using Go\n- [remember-go](https://github.com/rocketlaunchr/remember-go) - Cache slow database queries\n- [testing-go](https://github.com/rocketlaunchr/testing-go) - Testing framework for unit testing\n\n### Logo Credits\n\n1. Renee French (gopher)\n2. Samuel Jirénius (illustration)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocketlaunchr%2Fgo-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocketlaunchr%2Fgo-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocketlaunchr%2Fgo-pool/lists"}