{"id":17717281,"url":"https://github.com/bwesterb/go-and","last_synced_at":"2026-03-05T04:33:38.652Z","repository":{"id":247672212,"uuid":"826524692","full_name":"bwesterb/go-and","owner":"bwesterb","description":"Fast bitwise operations on byte-slices","archived":false,"fork":false,"pushed_at":"2026-01-21T09:53:19.000Z","size":83,"stargazers_count":2,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-21T21:09:36.094Z","etag":null,"topics":["avx","avx2","bitwise-and","bitwise-andnot","bitwise-or","bitwise-xor","neon","popcnt"],"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/bwesterb.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-09T21:54:02.000Z","updated_at":"2026-01-21T09:38:53.000Z","dependencies_parsed_at":"2024-08-28T15:04:26.282Z","dependency_job_id":"c3672614-b279-4178-8aa3-88d16615b08e","html_url":"https://github.com/bwesterb/go-and","commit_stats":null,"previous_names":["bwesterb/go-and"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/bwesterb/go-and","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fgo-and","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fgo-and/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fgo-and/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fgo-and/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwesterb","download_url":"https://codeload.github.com/bwesterb/go-and/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwesterb%2Fgo-and/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30110441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["avx","avx2","bitwise-and","bitwise-andnot","bitwise-or","bitwise-xor","neon","popcnt"],"created_at":"2024-10-25T14:19:40.494Z","updated_at":"2026-03-05T04:33:38.635Z","avatar_url":"https://github.com/bwesterb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-and\n======\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/bwesterb/go-and.svg)](https://pkg.go.dev/github.com/bwesterb/go-and)\n\nFast bitwise and, or, xor, andn, popcount and memset for `[]byte` slices.\n\n```go\nimport \"github.com/bwesterb/go-and\"\n\nfunc main() {\n    var a, b, dst []byte\n\n    // ...\n\n    // Sets dst to the bitwise and of a and b\n    and.And(dst, a, b)\n}\n```\n\nMakes use of AVX2 on AMD64 and NEON on ARM64.\n\n## Benchmarks\n\nCreated using `./benchmark.sh`.\n\nThis shows three benchmarks:\n\n* `naive` is a simple for loop doing one byte at a time.\n* `purego` are our slightly optimized versions that work on uint64s instead of bytes.\n* `asm` are the AVX2 implementations and the reason to use this library.\n\n### Intel Core i9-13900\n```\ngoos: linux\ngoarch: amd64\npkg: github.com/bwesterb/go-and\ncpu: 13th Gen Intel(R) Core(TM) i9-13900\n             │    naive     │                purego                │                 asm                 │\n             │    sec/op    │    sec/op     vs base                │   sec/op     vs base                │\nAnd-32         6844.5n ± 1%   2837.5n ± 0%  -58.54% (p=0.000 n=10)   365.9n ± 1%  -94.65% (p=0.000 n=10)\nOr-32          7098.5n ± 2%   2837.0n ± 0%  -60.03% (p=0.000 n=10)   371.7n ± 2%  -94.76% (p=0.000 n=10)\nXor-32         6875.5n ± 2%   2838.0n ± 1%  -58.72% (p=0.000 n=10)   368.9n ± 3%  -94.64% (p=0.000 n=10)\nAndNot-32      7587.0n ± 0%   3100.5n ± 0%  -59.13% (p=0.000 n=10)   367.3n ± 3%  -95.16% (p=0.000 n=10)\nAnyMasked-32   6337.5n ± 4%   1604.0n ± 2%  -74.69% (p=0.000 n=10)   369.3n ± 1%  -94.17% (p=0.000 n=10)\nAny-32         5673.0n ± 0%   1425.5n ± 0%  -74.87% (p=0.000 n=10)   208.8n ± 0%  -96.32% (p=0.000 n=10)\ngeomean         6.708µ         2.335µ       -65.20%                  335.3n       -95.00%\n\n             │    naive     │                 purego                 │                   asm                    │\n             │     B/s      │      B/s       vs base                 │      B/s        vs base                  │\nAnd-32         4.354Gi ± 1%   10.504Gi ± 0%  +141.23% (p=0.000 n=10)    81.456Gi ± 1%  +1770.70% (p=0.000 n=10)\nOr-32          4.198Gi ± 2%   10.507Gi ± 0%  +150.25% (p=0.000 n=10)    80.188Gi ± 2%  +1809.97% (p=0.000 n=10)\nXor-32         4.335Gi ± 2%   10.502Gi ± 1%  +142.27% (p=0.000 n=10)    80.798Gi ± 2%  +1764.01% (p=0.000 n=10)\nAndNot-32      3.928Gi ± 0%    9.612Gi ± 0%  +144.71% (p=0.000 n=10)    81.147Gi ± 3%  +1965.81% (p=0.000 n=10)\nAnyMasked-32   4.703Gi ± 4%   18.582Gi ± 2%  +295.16% (p=0.000 n=10)    80.698Gi ± 1%  +1616.04% (p=0.000 n=10)\nAny-32         5.254Gi ± 0%   20.906Gi ± 0%  +297.94% (p=0.000 n=10)   142.718Gi ± 0%  +2616.60% (p=0.000 n=10)\ngeomean        4.443Gi         12.77Gi       +187.34%                    88.89Gi       +1900.72%\n```\n\n### Apple M2 Pro\n\n```\ngoos: darwin\ngoarch: arm64\npkg: github.com/bwesterb/go-and\n          │    naive     │                purego                │                 asm                 │\n          │    sec/op    │    sec/op     vs base                │   sec/op     vs base                │\nAnd-12      9891.5n ± 0%   2248.0n ± 1%  -77.27% (p=0.000 n=10)   511.2n ± 1%  -94.83% (p=0.000 n=10)\nOr-12       9824.5n ± 1%   2267.5n ± 1%  -76.92% (p=0.000 n=10)   511.2n ± 1%  -94.80% (p=0.000 n=10)\nXor-12      9826.5n ± 0%   2232.0n ± 1%  -77.29% (p=0.000 n=10)   509.8n ± 1%  -94.81% (p=0.000 n=10)\nAndNot-12   9928.5n ± 1%   2251.0n ± 1%  -77.33% (p=0.000 n=10)   581.7n ± 0%  -94.14% (p=0.000 n=10)\nMemset-12   294.96µ ± 1%    79.18µ ± 2%  -73.15% (p=0.000 n=10)   10.83µ ± 7%  -96.33% (p=0.000 n=10)\nPopcnt-12   288.90µ ± 1%    45.24µ ± 0%  -84.34% (p=0.000 n=10)   11.30µ ± 0%  -96.09% (p=0.000 n=10)\ngeomean      30.52µ         6.716µ       -77.99%                  1.455µ       -95.23%\n\n          │    naive     │                 purego                 │                   asm                   │\n          │     B/s      │      B/s       vs base                 │      B/s       vs base                  │\nAnd-12      3.013Gi ± 0%   13.256Gi ± 1%  +339.97% (p=0.000 n=10)   58.297Gi ± 1%  +1834.87% (p=0.000 n=10)\nOr-12       3.033Gi ± 1%   13.144Gi ± 1%  +333.30% (p=0.000 n=10)   58.303Gi ± 1%  +1821.98% (p=0.000 n=10)\nXor-12      3.033Gi ± 0%   13.353Gi ± 1%  +340.28% (p=0.000 n=10)   58.462Gi ± 1%  +1827.64% (p=0.000 n=10)\nAndNot-12   3.002Gi ± 1%   13.240Gi ± 1%  +341.07% (p=0.000 n=10)   51.233Gi ± 0%  +1606.77% (p=0.000 n=10)\nMemset-12   3.157Gi ± 1%   11.761Gi ± 2%  +272.50% (p=0.000 n=10)   86.041Gi ± 7%  +2625.05% (p=0.000 n=10)\nPopcnt-12   3.224Gi ± 1%   20.585Gi ± 0%  +538.57% (p=0.000 n=10)   82.407Gi ± 0%  +2456.30% (p=0.000 n=10)\ngeomean     3.076Gi         13.98Gi       +354.43%                   64.53Gi       +1997.80%\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwesterb%2Fgo-and","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwesterb%2Fgo-and","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwesterb%2Fgo-and/lists"}