{"id":16486994,"url":"https://github.com/ethe/goroutinepool","last_synced_at":"2025-05-02T08:30:52.319Z","repository":{"id":57537470,"uuid":"140056680","full_name":"ethe/GoroutinePool","owner":"ethe","description":"Goroutine pool","archived":false,"fork":false,"pushed_at":"2020-11-09T08:06:47.000Z","size":6,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-07T00:12:21.769Z","etag":null,"topics":[],"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/ethe.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}},"created_at":"2018-07-07T05:52:23.000Z","updated_at":"2020-11-09T08:06:49.000Z","dependencies_parsed_at":"2022-09-04T13:51:05.423Z","dependency_job_id":null,"html_url":"https://github.com/ethe/GoroutinePool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethe%2FGoroutinePool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethe%2FGoroutinePool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethe%2FGoroutinePool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethe%2FGoroutinePool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethe","download_url":"https://codeload.github.com/ethe/GoroutinePool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252008737,"owners_count":21679633,"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":[],"created_at":"2024-10-11T13:31:50.987Z","updated_at":"2025-05-02T08:30:52.040Z","avatar_url":"https://github.com/ethe.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Deprecated: On Go 1.11.2 goroutine pool has already slower than native `go` keyword.**\n\n# Goroutine Pool\nThe pool implementation of Go goroutine, it is useful to avoid heavy pressure of `runtime.morestack ` when using goroutine.\nIt could recycle rather than free goroutines after executed. If the recycled goroutines not be stack reduced yet, then there is no need to request more stack.\n\n\n## Benchmark\n```\ngoos: darwin\ngoarch: amd64\npkg: eleme/nex/utils/gp\nBenchmarkGoPool-4          \t 2000000\t       753 ns/op\t      32 B/op\t       1 allocs/op\nBenchmarkGo-4              \t 5000000\t       318 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkMorestackPool-4   \t 1000000\t      2551 ns/op\t      64 B/op\t       3 allocs/op\nBenchmarkMoreStack-4       \t  300000\t      3758 ns/op\t      16 B/op\t       1 allocs/op\n```\n\n## Usage\n```go\npackage main\n\nimport (\n  \"time\"\n\n  \"github.com/ethe/GoroutinePool\"\n)\n\nfunc main() {\n  pool := gp.New(20 * time.Second)  // set idle timeout\n  pool.Go(func() {}) // same as `go func(){}()`\n}\n\n```\n\n## Lock-free Queue\nIt also contains a lock-free queue (linked list) minimal implementation.\n\n```go\npackage main\n\nimport (  \n  \"fmt\"\n\n  \"github.com/ethe/GoroutinePool\"\n)\n\nfunc main() {\n  queue := NewQueue()\n  queue.Put(1)\n  fmt.Println(queue.Get())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethe%2Fgoroutinepool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethe%2Fgoroutinepool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethe%2Fgoroutinepool/lists"}