{"id":18312190,"url":"https://github.com/whomwah/rqrcode_core","last_synced_at":"2026-01-08T18:04:36.263Z","repository":{"id":34999839,"uuid":"190599844","full_name":"whomwah/rqrcode_core","owner":"whomwah","description":"A Ruby QRCode encoding library","archived":false,"fork":false,"pushed_at":"2025-12-09T19:41:29.000Z","size":448,"stargazers_count":46,"open_issues_count":1,"forks_count":26,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-12-22T12:57:24.309Z","etag":null,"topics":["qrcode"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/whomwah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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},"funding":{"github":"whomwah","buy_me_a_coffee":"duncanrobertson"}},"created_at":"2019-06-06T14:54:52.000Z","updated_at":"2025-12-09T13:00:56.000Z","dependencies_parsed_at":"2025-05-15T15:06:35.018Z","dependency_job_id":"80db99fa-b57b-4050-b2ec-0c00f321fa24","html_url":"https://github.com/whomwah/rqrcode_core","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/whomwah/rqrcode_core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode_core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode_core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode_core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode_core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whomwah","download_url":"https://codeload.github.com/whomwah/rqrcode_core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode_core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28051298,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["qrcode"],"created_at":"2024-11-05T16:23:04.443Z","updated_at":"2026-01-08T18:04:36.252Z","avatar_url":"https://github.com/whomwah.png","language":"Ruby","funding_links":["https://github.com/sponsors/whomwah","https://buymeacoffee.com/duncanrobertson"],"categories":[],"sub_categories":[],"readme":"![](https://github.com/whomwah/rqrcode_core/actions/workflows/ruby.yml/badge.svg)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)\n\n# RQRCodeCore\n\n`rqrcode_core` is a library for encoding QR Codes in pure Ruby. It has a simple interface with all the standard QR Code options. It was originally adapted in 2008 from a Javascript library by [Kazuhiko Arase](https://github.com/kazuhikoarase).\n\nFeatures:\n\n- `rqrcode_core` is a Ruby only library. It requires no 3rd party libraries. Just Ruby!\n- It is an encoding library. You can't decode QR Codes with it.\n- The interface is simple and assumes you just want to encode a string into a QR Code, but also allows for encoding multiple segments.\n- QR Code is trade marked by Denso Wave inc.\n- Minimum Ruby version is `\u003e= 3.2.0`\n\n`rqrcode_core` is the basis of the popular `rqrcode` gem [https://github.com/whomwah/rqrcode]. This gem allows you to generate different renderings of your QR Code, including `png`, `svg` and `ansi`.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"rqrcode_core\"\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rqrcode_core\n\n## Basic Usage\n\n```ruby\n$ require \"rqrcode_core\"\n$ qr = RQRCodeCore::QRCode.new(\"https://kyan.com\")\n$ puts qr.to_s\n```\n\nOutput:\n\n```\nxxxxxxx x  x x   x x  xx  xxxxxxx\nx     x  xxx  xxxxxx xxx  x     x\nx xxx x  xxxxx x       xx x xxx x\n... etc\n```\n\n## Multiple Encoding Support\n\n```ruby\n$ require \"rqrcode_core\"\n$ qr = RQRCodeCore::QRCode.new([\n  {data: \"byteencoded\", mode: :byte_8bit},\n  {data: \"A1\" * 100, mode: :alphanumeric},\n  {data: \"1\" * 500, mode: :number}\n])\n```\n\nThis will create a QR Code with byte encoded, alphanumeric and number segments. Any combination of encodings/segments will work provided it fits within size limits.\n\n## Doing your own rendering\n\n```ruby\nrequire \"rqrcode_core\"\n\nqr = RQRCodeCore::QRCode.new(\"https://kyan.com\")\nqr.modules.each do |row|\n  row.each do |col|\n    print col ? \"#\" : \" \"\n  end\n\n  print \"\\n\"\nend\n```\n\n### Options\n\nThe library expects a string or array (for multiple encodings) to be parsed in, other args are optional.\n\n```\ndata - the string or array you wish to encode\n\nsize - the size (integer) of the QR Code (defaults to smallest size needed to encode the string)\n\nmax_size - the max_size (Integer) of the QR Code (default RQRCodeCore::QRUtil.max_size)\n\nlevel  - the error correction level, can be:\n  * Level :l 7%  of code can be restored\n  * Level :m 15% of code can be restored\n  * Level :q 25% of code can be restored\n  * Level :h 30% of code can be restored (default :h)\n\nmode - the mode of the QR Code (defaults to alphanumeric or byte_8bit, depending on the input data, only used when data is a string):\n  * :number\n  * :alphanumeric\n  * :byte_8bit\n```\n\n#### Example\n\n```ruby\nRQRCodeCore::QRCode.new(\"http://kyan.com\", size: 2, level: :m, mode: :byte_8bit)\n```\n\n## Development\n\n### Tests\n\nYou can run the test suite using:\n\n```\n$ ./bin/setup\n$ rake\n```\n\nor try the project from the console with:\n\n```\n$ ./bin/console\n```\n\n### Linting\n\nThe project uses [standardrb](https://github.com/testdouble/standard) and can be run with:\n\n```\n$ ./bin/setup\n$ rake standard # check\n$ rake standard:fix # fix\n```\n\n## Performance Optimisation\n\n### Reduce Memory Usage by 70-76%\n\n**If you're running on a 64-bit system, you can dramatically reduce memory consumption by setting:**\n\n```ruby\nENV['RQRCODE_CORE_ARCH_BITS'] = '32'\n```\n\nOr from the command line:\n\n```bash\nRQRCODE_CORE_ARCH_BITS=32 ruby your_script.rb\n```\n\n#### Benchmark Results (64-bit vs 32-bit on 64-bit systems)\n\n**Memory Savings:**\n- Single small QR code: 0.38 MB → 0.10 MB (**74% reduction**)\n- Single large QR code: 8.53 MB → 2.92 MB (**66% reduction**)\n- 100 small QR codes: 37.91 MB → 9.10 MB (**76% reduction**)\n- 10 large QR codes: 85.32 MB → 29.19 MB (**66% reduction**)\n\n**Speed Improvement:**\n- 2-4% faster across all scenarios (better cache utilization, reduced GC pressure)\n\n**Object Allocation:**\n- 85-87% fewer objects allocated\n- Integer allocations nearly eliminated (from 70-76% to ~0%)\n\n#### Why This Works\n\nThe QR code algorithm doesn't require 64-bit integers for its bit manipulation operations—32-bit is sufficient for all calculations. By default, Ruby on 64-bit systems uses 64-bit integers, which causes unnecessary memory allocation during the internal \"right shift zero fill\" operations.\n\n**Recommendation:** Use `RQRCODE_CORE_ARCH_BITS=32` for production workloads, especially when:\n- Generating QR codes in batch\n- Running in memory-constrained environments\n- Handling high-concurrency web requests\n- Processing large QR codes (version 10+)\n\nSee `test/benchmarks/ARCH_BITS_ANALYSIS.md` for detailed benchmark data and analysis.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/whomwah/rqrcode_core.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhomwah%2Frqrcode_core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhomwah%2Frqrcode_core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhomwah%2Frqrcode_core/lists"}