{"id":13694061,"url":"https://github.com/smallnest/queue","last_synced_at":"2025-03-25T02:30:50.945Z","repository":{"id":57542612,"uuid":"285814849","full_name":"smallnest/queue","owner":"smallnest","description":"lock-free queue and other implementations","archived":false,"fork":false,"pushed_at":"2023-10-17T03:33:42.000Z","size":13,"stargazers_count":127,"open_issues_count":1,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T06:43:08.558Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smallnest.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}},"created_at":"2020-08-07T11:39:58.000Z","updated_at":"2024-10-18T13:00:52.000Z","dependencies_parsed_at":"2024-01-14T19:05:35.334Z","dependency_job_id":"93f2a7e9-5451-473c-a653-0527a81cab0b","html_url":"https://github.com/smallnest/queue","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/smallnest%2Fqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallnest%2Fqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallnest%2Fqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallnest%2Fqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallnest","download_url":"https://codeload.github.com/smallnest/queue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245385297,"owners_count":20606642,"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-08-02T17:01:23.475Z","updated_at":"2025-03-25T02:30:50.613Z","avatar_url":"https://github.com/smallnest.png","language":"Go","readme":"# queue\n```go\nimport \"github.com/smallnest/queue\"\n```\nPackage queue provides multiple queue implementations. \nThe lock-free and two-lock algorithms are from Michael and Scott. https://doi.org/10.1145/248052.248106\n\n## Queue\n\nA queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and the removal of entities from the other end of the sequence.The operations of a queue make it a first-in-first-out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. \n\nPackage queue defines `Queue` interface:\n\n```go\ntype Queue[T any] interface {\n\tEnqueue(v T)\n\tDequeue() T\n}\n```\n\nCurrently it contains three implementations:\n\n- lock-free queue: `LKQueue`\n- two-lock queue: `CQueue`\n- slice-based queue: `SliceQueue`\n\n\n## Benchmark\n\n\n```sh\ngoos: darwin\ngoarch: amd64\npkg: github.com/smallnest/queue\n\nBenchmarkQueue/lock-free_queue#4-8         \t 4835329\t       266.2 ns/op\t      16 B/op\t       1 allocs/op\nBenchmarkQueue/two-lock_queue#4-8          \t 9112242\t       168.0 ns/op\t      16 B/op\t       1 allocs/op\nBenchmarkQueue/slice-based_queue#4-8       \t 8778811\t       182.0 ns/op\t      40 B/op\t       0 allocs/op\n\nBenchmarkQueue/two-lock_queue#32-8         \t 9109314\t       133.1 ns/op\t      16 B/op\t       1 allocs/op\nBenchmarkQueue/slice-based_queue#32-8      \t 7939176\t       171.8 ns/op\t      54 B/op\t       0 allocs/op\nBenchmarkQueue/lock-free_queue#32-8        \t 4735264\t       253.8 ns/op\t      16 B/op\t       1 allocs/op\n\nBenchmarkQueue/lock-free_queue#1024-8      \t 4654297\t       242.6 ns/op\t      16 B/op\t       1 allocs/op\nBenchmarkQueue/two-lock_queue#1024-8       \t 7714422\t       138.2 ns/op\t      16 B/op\t       1 allocs/op\nBenchmarkQueue/slice-based_queue#1024-8    \t 8609463\t       169.7 ns/op\t      34 B/op\t       0 allocs/op\n```","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallnest%2Fqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallnest%2Fqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallnest%2Fqueue/lists"}