{"id":13786759,"url":"https://github.com/mna/gocostmodel","last_synced_at":"2025-03-22T00:32:57.833Z","repository":{"id":24797670,"uuid":"28211608","full_name":"mna/gocostmodel","owner":"mna","description":"Benchmarks of common basic operations for the Go language.","archived":false,"fork":false,"pushed_at":"2021-05-19T15:19:44.000Z","size":226,"stargazers_count":61,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T17:11:06.951Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["mna"],"custom":["https://www.buymeacoffee.com/mna"]}},"created_at":"2014-12-19T02:54:45.000Z","updated_at":"2023-10-04T00:33:48.000Z","dependencies_parsed_at":"2022-08-22T16:50:53.565Z","dependency_job_id":null,"html_url":"https://github.com/mna/gocostmodel","commit_stats":null,"previous_names":["puerkitobio/gocostmodel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fgocostmodel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fgocostmodel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fgocostmodel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mna%2Fgocostmodel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mna","download_url":"https://codeload.github.com/mna/gocostmodel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244890102,"owners_count":20527030,"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-03T19:01:34.248Z","updated_at":"2025-03-22T00:32:57.536Z","avatar_url":"https://github.com/mna.png","language":"Go","funding_links":["https://github.com/sponsors/mna","https://www.buymeacoffee.com/mna"],"categories":["Benchmarks","Twitter"],"sub_categories":["Other Software"],"readme":"# gocostmodel\n\nThis package was inspired by Brian W. Kernighan and Rob Pike's book \"The Practice of Programming\" (Addison-Wesley, 1999). In Chapter 7 on performance, section 7.6 (Estimation):\n\n\u003e \"It's hard to estimate ahead of time how fast a program will be [...]. It's easy, though, to create a *cost model* for a language or a system, which will give you at least a rough idea of how long important operations take.\"\n\nThis is a *cost model* that benchmarks common basic operations for the Go language. For it to be meaningful, it should be run on your target hardware, and the relative performance of operations is probably more important than the actual numbers. Examples of such results on a variety of hardware is available in the `bench/` folder.\n\nThere may be places where compiler optimizations render some benchmarks moot. If you find any such occurrences, please open an issue or send a pull request.\n\nThe names of the `*_test.go` source files should give an idea of the category of operations that are benchmarked.\n\n## Example\n\nHere is a short example of benchmark results, run on a Toshiba Chromebook 64-bit running Ubuntu (LXDE) with crouton:\n\n```\nBenchmarkConvIntToFloat64\t1000000000\t         2.16 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkConvFloat64ToInt\t2000000000\t         1.26 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkConvIntToFloat32\t2000000000\t         1.44 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkConvFloat32ToInt\t2000000000\t         1.42 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkConvStringToInt\t30000000\t        57.8 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkConvIntToString\t20000000\t       108 ns/op\t       1 B/op\t       1 allocs/op\nBenchmarkStringToByte\t20000000\t       110 ns/op\t       8 B/op\t       1 allocs/op\nBenchmarkByteToString\t20000000\t        84.8 ns/op\t       4 B/op\t       1 allocs/op\nBenchmarkFindSliceInt5\t100000000\t        13.0 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindSliceStr5\t20000000\t        64.9 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindSliceInt100\t10000000\t       236 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindSliceStr100\t 1000000\t      1248 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindMapInt5\t100000000\t        22.2 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindMapStr5\t20000000\t        77.6 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindMapInt100\t30000000\t        58.3 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFindMapStr100\t20000000\t        76.2 ns/op\t       0 B/op\t       0 allocs/op\nBenchmarkFloat32Assign\t2000000000\t         0.99 ns/op\t       0 B/op\t       0 allocs/op\n```\n\n## Installation\n\n    $ go get github.com/PuerkitoBio/gocostmodel\n\n## Running the benchmarks\n\n    $ go test -run zz -bench . [-benchmem]\n\n## Contributing\n\nPull requests are welcome, but the benchmarks should be for common basic operations, in the spirit of the existing benchmarks.\n\n## License\n\nThis source code is released under the [BSD 3-clause license][bsd].\n\n[bsd]: http://opensource.org/licenses/BSD-3-Clause\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmna%2Fgocostmodel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmna%2Fgocostmodel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmna%2Fgocostmodel/lists"}