{"id":26826693,"url":"https://github.com/hslam/buffer","last_synced_at":"2025-06-26T14:31:45.562Z","repository":{"id":57573041,"uuid":"350922806","full_name":"hslam/buffer","owner":"hslam","description":"Package buffer implements a variable-sized bytes pool.","archived":false,"fork":false,"pushed_at":"2023-02-17T20:28:59.000Z","size":29,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T11:32:41.531Z","etag":null,"topics":["buffer","bytes","go","golang","pool"],"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/hslam.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":"2021-03-24T02:34:26.000Z","updated_at":"2024-11-21T01:36:53.000Z","dependencies_parsed_at":"2024-06-21T14:18:17.848Z","dependency_job_id":"bfc27421-ac61-4903-8ae3-6f8b39de14c4","html_url":"https://github.com/hslam/buffer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hslam/buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fbuffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fbuffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fbuffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fbuffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslam","download_url":"https://codeload.github.com/hslam/buffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslam%2Fbuffer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262084650,"owners_count":23256279,"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":["buffer","bytes","go","golang","pool"],"created_at":"2025-03-30T11:30:36.529Z","updated_at":"2025-06-26T14:31:45.480Z","avatar_url":"https://github.com/hslam.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# buffer\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/hslam/buffer)](https://pkg.go.dev/github.com/hslam/buffer)\n[![Build Status](https://github.com/hslam/buffer/workflows/build/badge.svg)](https://github.com/hslam/buffer/actions)\n[![codecov](https://codecov.io/gh/hslam/buffer/branch/master/graph/badge.svg)](https://codecov.io/gh/hslam/buffer)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hslam/buffer)](https://goreportcard.com/report/github.com/hslam/buffer)\n[![LICENSE](https://img.shields.io/github/license/hslam/buffer.svg?style=flat-square)](https://github.com/hslam/buffer/blob/master/LICENSE)\n\nPackage buffer implements a variable-sized bytes pool.\n\n## Get started\n\n### Install\n```\ngo get github.com/hslam/buffer\n```\n### Import\n```\nimport \"github.com/hslam/buffer\"\n```\n### Usage\n#### Simple Example\n```go\npackage main\n\nimport (\n\t\"github.com/hslam/buffer\"\n)\n\nfunc main() {\n\tbuf := buffer.GetBuffer(1024)\n\tbuffer.PutBuffer(buf)\n}\n```\n\n#### Example\n```go\npackage main\n\nimport (\n\t\"github.com/hslam/buffer\"\n)\n\nfunc main() {\n\tbuffers := buffer.NewBuffers(1024)\n\tsize := 65536\n\n\tbuf := buffers.GetBuffer(size)\n\tbuffers.PutBuffer(buf)\n\n\tp := buffers.AssignPool(size)\n\tbuf = p.GetBuffer(size)\n\tp.PutBuffer(buf)\n}\n```\n\n### Benchmark\ngo test -bench=. -benchmem -benchtime=10s -timeout 30m\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/hslam/buffer\nBenchmarkAssignPool-8        \t1000000000\t         4.507 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkAssignSizedPool-8   \t699822374\t        16.72 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkBuffers-8           \t254406498\t        46.63 ns/op\t      24 B/op\t       1 allocs/op\nBenchmarkSizedBuffer-8       \t302837005\t        39.32 ns/op\t      24 B/op\t       1 allocs/op\nPASS\nok  \tgithub.com/hslam/buffer\t51.466s\n```\n\n## License\nThis package is licensed under a MIT license (Copyright (c) 2021 Meng Huang)\n\n## Author\nbuffer was written by Meng Huang.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fbuffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslam%2Fbuffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslam%2Fbuffer/lists"}