{"id":16942458,"url":"https://github.com/tmthrgd/go-memset","last_synced_at":"2025-03-17T08:36:57.362Z","repository":{"id":57483326,"uuid":"62798829","full_name":"tmthrgd/go-memset","owner":"tmthrgd","description":"An efficient memset implementation for Golang. [Not maintained].","archived":true,"fork":false,"pushed_at":"2019-09-04T06:04:39.000Z","size":15,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T05:31:10.179Z","etag":null,"topics":["amd64","asm","assembly","avx","golang","memset","simd","sse","x64","x86-64","zero"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/tmthrgd/go-memset","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/tmthrgd.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":"2016-07-07T10:34:02.000Z","updated_at":"2024-12-14T00:22:19.000Z","dependencies_parsed_at":"2022-08-27T23:21:56.857Z","dependency_job_id":null,"html_url":"https://github.com/tmthrgd/go-memset","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/tmthrgd%2Fgo-memset","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmthrgd%2Fgo-memset/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmthrgd%2Fgo-memset/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmthrgd%2Fgo-memset/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmthrgd","download_url":"https://codeload.github.com/tmthrgd/go-memset/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244001622,"owners_count":20381802,"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":["amd64","asm","assembly","avx","golang","memset","simd","sse","x64","x86-64","zero"],"created_at":"2024-10-13T21:12:00.599Z","updated_at":"2025-03-17T08:36:56.932Z","avatar_url":"https://github.com/tmthrgd.png","language":"Go","readme":"# go-memset\n\n[![GoDoc](https://godoc.org/github.com/tmthrgd/go-memset?status.svg)](https://godoc.org/github.com/tmthrgd/go-memset)\n[![Build Status](https://travis-ci.org/tmthrgd/go-memset.svg?branch=master)](https://travis-ci.org/tmthrgd/go-memset)\n\nAn efficient memset implementation for Golang.\n\nIn Golang the following loop is optimised with an assembly implementation in src/runtime/memclr_$GOARCH.s\n(since [137880043](https://golang.org/cl/137880043)):\n```\nfor i := range data {\n\tdata[i] = 0\n}\n```\nbut the following loop is *not* optimised:\n```\nfor i := range data {\n\tdata[i] = 0xff\n}\n```\nand neither is:\n```\nfor i := range data {\n\tdata[i] = value\n}\n```\n\ngo-memset provides a Memset function which uses an assembly implementation on x86-64 and can provide\nperformance equivalent to the optimised first loop.\n\n## Download\n\n```\ngo get github.com/tmthrgd/go-memset\n```\n\n## Benchmark\n\n```\nBenchmarkMemset/32-8  \t200000000\t         6.32 ns/op\t5060.69 MB/s\nBenchmarkMemset/128-8 \t200000000\t         6.55 ns/op\t19527.77 MB/s\nBenchmarkMemset/1k-8  \t50000000\t        22.9 ns/op\t44788.18 MB/s\nBenchmarkMemset/16k-8 \t 5000000\t       278 ns/op\t58868.04 MB/s\nBenchmarkMemset/128k-8\t  500000\t      3726 ns/op\t35171.08 MB/s\nBenchmarkMemset/1M-8  \t   30000\t     40219 ns/op\t26071.10 MB/s\nBenchmarkMemset/16M-8 \t    2000\t   1120266 ns/op\t14976.09 MB/s\nBenchmarkMemset/128M-8\t     200\t   8749141 ns/op\t15340.67 MB/s\nBenchmarkMemset/512M-8\t      50\t  35078079 ns/op\t15305.03 MB/s\n```\n\n```\nBenchmarkGoZero/32-8  \t500000000\t         3.43 ns/op\t9326.33 MB/s\nBenchmarkGoZero/128-8 \t300000000\t         4.50 ns/op\t28414.80 MB/s\nBenchmarkGoZero/1k-8  \t100000000\t        19.1 ns/op\t53557.45 MB/s\nBenchmarkGoZero/16k-8 \t 5000000\t       278 ns/op\t58854.20 MB/s\nBenchmarkGoZero/128k-8\t  500000\t      3733 ns/op\t35102.85 MB/s\nBenchmarkGoZero/1M-8  \t   50000\t     39968 ns/op\t26234.86 MB/s\nBenchmarkGoZero/16M-8 \t    1000\t   1319397 ns/op\t12715.81 MB/s\nBenchmarkGoZero/128M-8\t     100\t  10682865 ns/op\t12563.83 MB/s\nBenchmarkGoZero/512M-8\t      30\t  42689135 ns/op\t12576.29 MB/s\nBenchmarkGoSet/32-8   \t100000000\t        17.4 ns/op\t1840.05 MB/s\nBenchmarkGoSet/128-8  \t20000000\t        73.0 ns/op\t1754.20 MB/s\nBenchmarkGoSet/1k-8   \t 3000000\t       545 ns/op\t1878.82 MB/s\nBenchmarkGoSet/16k-8  \t  200000\t      8638 ns/op\t1896.63 MB/s\nBenchmarkGoSet/128k-8 \t   20000\t     69077 ns/op\t1897.47 MB/s\nBenchmarkGoSet/1M-8   \t    3000\t    552612 ns/op\t1897.49 MB/s\nBenchmarkGoSet/16M-8  \t     200\t   8867019 ns/op\t1892.09 MB/s\nBenchmarkGoSet/128M-8 \t      20\t  70937303 ns/op\t1892.06 MB/s\nBenchmarkGoSet/512M-8 \t       5\t 283412563 ns/op\t1894.31 MB/s\n```\n\n```\nbenchmark                old ns/op     new ns/op     delta\nBenchmarkZero/32-8       3.43          6.32          +84.26%\nBenchmarkZero/128-8      4.50          6.55          +45.56%\nBenchmarkZero/1k-8       19.1          22.9          +19.90%\nBenchmarkZero/16k-8      278           278           +0.00%\nBenchmarkZero/128k-8     3733          3726          -0.19%\nBenchmarkZero/1M-8       39968         40219         +0.63%\nBenchmarkZero/16M-8      1319397       1120266       -15.09%\nBenchmarkZero/128M-8     10682865      8749141       -18.10%\nBenchmarkZero/512M-8     42689135      35078079      -17.83%\nBenchmarkSet/32-8        17.4          6.32          -63.68%\nBenchmarkSet/128-8       73.0          6.55          -91.03%\nBenchmarkSet/1k-8        545           22.9          -95.80%\nBenchmarkSet/16k-8       8638          278           -96.78%\nBenchmarkSet/128k-8      69077         3726          -94.61%\nBenchmarkSet/1M-8        552612        40219         -92.72%\nBenchmarkSet/16M-8       8867019       1120266       -87.37%\nBenchmarkSet/128M-8      70937303      8749141       -87.67%\nBenchmarkSet/512M-8      283412563     35078079      -87.62%\n\nbenchmark                old MB/s     new MB/s     speedup\nBenchmarkZero/32-8       9326.33      5060.69      0.54x\nBenchmarkZero/128-8      28414.80     19527.77     0.69x\nBenchmarkZero/1k-8       53557.45     44788.18     0.84x\nBenchmarkZero/16k-8      58854.20     58868.04     1.00x\nBenchmarkZero/128k-8     35102.85     35171.08     1.00x\nBenchmarkZero/1M-8       26234.86     26071.10     0.99x\nBenchmarkZero/16M-8      12715.81     14976.09     1.18x\nBenchmarkZero/128M-8     12563.83     15340.67     1.22x\nBenchmarkZero/512M-8     12576.29     15305.03     1.22x\nBenchmarkSet/32-8        1840.05      5060.69      2.75x\nBenchmarkSet/128-8       1754.20      19527.77     11.13x\nBenchmarkSet/1k-8        1878.82      44788.18     23.84x\nBenchmarkSet/16k-8       1896.63      58868.04     31.04x\nBenchmarkSet/128k-8      1897.47      35171.08     18.54x\nBenchmarkSet/1M-8        1897.49      26071.10     13.74x\nBenchmarkSet/16M-8       1892.09      14976.09     7.92x\nBenchmarkSet/128M-8      1892.06      15340.67     8.11x\nBenchmarkSet/512M-8      1894.31      15305.03     8.08x\n```\n\n## License\n\nUnless otherwise noted, the go-memset source files are distributed under the Modified BSD License\nfound in the LICENSE file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmthrgd%2Fgo-memset","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmthrgd%2Fgo-memset","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmthrgd%2Fgo-memset/lists"}