{"id":15687823,"url":"https://github.com/orisano/unroller","last_synced_at":"2025-10-05T20:50:25.156Z","repository":{"id":174930635,"uuid":"652915450","full_name":"orisano/unroller","owner":"orisano","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-06T13:36:09.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-30T03:52:43.153Z","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/orisano.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":"2023-06-13T03:44:00.000Z","updated_at":"2025-06-06T13:36:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab3101af-bd61-400c-93cd-73403ff0c930","html_url":"https://github.com/orisano/unroller","commit_stats":null,"previous_names":["orisano/unroller"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/orisano/unroller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orisano%2Funroller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orisano%2Funroller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orisano%2Funroller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orisano%2Funroller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orisano","download_url":"https://codeload.github.com/orisano/unroller/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orisano%2Funroller/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262857264,"owners_count":23375490,"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-10-03T17:51:15.872Z","updated_at":"2025-10-05T20:50:20.133Z","avatar_url":"https://github.com/orisano.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unroller\n\nunroller is a tool for loop unrolling in Go. It generates unrolled versions of functions by adding comments to the top-level for loops.\n\nLoop unrolling is an optimization technique where the compiler expands the iterations of a loop, reducing the overhead of iteration. This can improve the execution speed of the code.\n\n## Installation\n\nTo install unroller, you need to have Go installed and set up. Then, you can use the following `go install` command:\n\n```shell\ngo install github.com/orisano/unroller@latest\n```\n\n## Usage\n\nunroller is intended to be used with `go generate`. To generate an unrolled version of a file, add the comment `//go:generate unroller` to the file. For each function that you want to unroll, add the comment `// UNROLL` immediately before the corresponding for loop. When you run `go generate` on that file, unroller will generate a new file with the name `{filename}_unrolled.go`. You can use the `-o` option to specify a different output file name.\n\nExample usage in a file:\n\n```go\n//go:generate unroller -o unrolled_file.go\npackage main\n\nimport \"fmt\"\n\nfunc foo() {\n    fmt.Println(\"start\")\n    // UNROLL\n    for i := 0; i \u003c 5; i++ {\n        fmt.Println(i)\n    }\n    fmt.Println(\"end\")\n}\n```\n\nTo generate the unrolled version, run the following command:\n\n```shell\ngo generate path/to/your/file.go\n```\n\nThe generated unrolled file will have the following content:\n\n```go\n// Code generated by unroller. DO NOT EDIT.\npackage main\n\nimport \"fmt\"\n\nfunc fooUnrolled() {\n    fmt.Println(\"start\")\n    {\n        const i = 0\n        fmt.Println(i)\n    }\n    {\n        const i = 1\n        fmt.Println(i)\n    }\n    {\n        const i = 2\n        fmt.Println(i)\n    }\n    {\n        const i = 3\n        fmt.Println(i)\n    }\n    {\n        const i = 4\n        fmt.Println(i)\n    }\n    fmt.Println(\"end\")\n}\n```\n\nYou can then use the generated unrolled file in your codebase.\n\nIt's important to note that the `// UNROLL` comment should be placed immediately before the for loop that you want to unroll. Also, remember to include the `//go:generate unroller` comment at the top of the file to ensure that the unrolling process is triggered when running go generate.\n\n## Limitations\n\n* unroller currently supports only top-level for loops. Nested loops are not supported.\n\n## Contributing\nContributions to unroller are welcome! If you find a bug or have a suggestion, please open an issue on the GitHub repository.\n\n## License\nunroller is licensed under the MIT License. See the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forisano%2Funroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forisano%2Funroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forisano%2Funroller/lists"}