{"id":25585447,"url":"https://github.com/pawandubey/troml","last_synced_at":"2025-04-12T20:30:36.111Z","repository":{"id":38179013,"uuid":"504961699","full_name":"pawandubey/troml","owner":"pawandubey","description":"Blazing fast TOML parsing in Ruby, with Rust","archived":false,"fork":false,"pushed_at":"2022-06-23T05:22:36.000Z","size":39,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T15:23:36.434Z","etag":null,"topics":["gem","ruby","toml","toml-parser"],"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/pawandubey.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-18T22:17:45.000Z","updated_at":"2023-01-13T03:52:52.000Z","dependencies_parsed_at":"2022-09-04T14:10:55.431Z","dependency_job_id":null,"html_url":"https://github.com/pawandubey/troml","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawandubey%2Ftroml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawandubey%2Ftroml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawandubey%2Ftroml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawandubey%2Ftroml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pawandubey","download_url":"https://codeload.github.com/pawandubey/troml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248629140,"owners_count":21136204,"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":["gem","ruby","toml","toml-parser"],"created_at":"2025-02-21T07:17:07.593Z","updated_at":"2025-04-12T20:30:36.089Z","avatar_url":"https://github.com/pawandubey.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n# @markup markdown\n--\u003e\n\n# Troml\n\n\u003e ⚠ Alpha quality software. Consider it a side project and read the [gotchas](#current-gotchas) and [contribution guidelines](#contributing).\n\nBlazing fast [TOML](https://toml.io) parsing, with the power of Rust ⚡\n\nTroml utilizes [rutie](https://github.com/danielpclark/rutie) to parse TOML by delegating the actual parsing to Rust-land. The Rust code uses the canonical [toml](https://github.com/alexcrichton/toml-rs) package that's also used by Cargo.\n\nAs of June 2022, Troml is approximately **30 thousand times** faster than the `toml` ruby gem at parsing the `test/data/spec.toml` file in this repository, as measured on a Thinkpad T470 with Intel Core i7-7500U @ 4x 3.5GHz and 12GB of RAM running KDE Neon 20.04 with Rust 1.57.0 and Ruby 3.1.2.\n\n## Installation\n\n\u003e ⚠ Currently, the native extension is built locally, so having rustc and cargo is a prerequisite.\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add troml\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install troml\n\n## Usage\n\n```ruby\n# Parse TOML strings with Troml.parse\nTroml.parse(\"foo='bar'\")\n# =\u003e {\"foo\"=\u003e\"bar\"}\n\n# Read and parse the contents of a file with\nTroml.parse_file(\"path/to/file.toml\")\n```\n\n## Current Gotchas\n- Troml only deserializes TOML documents, it does not generate them.\n- Troml uses `rutie`, which at this time has a bug where [it leaks memory when it tries to raise in Ruby from Rust](https://github.com/danielpclark/rutie/issues/159). Troml raises on parse failures currently. This means that if you are encountering a lot of parse failures, your program will end up consuming a lot of memory. I have a fix for this in mind and will implement it soon.\n- Troml packaging depends on the Cargo extension builder toolchain in Rubygems. As that is a recently-shipped feature, there might be bugs in the packaging of this gem.\n\n## Performance\n\nThe benchmark is located in `bin/benchmark`. Here is a sample benchmark run from my laptop:\n\n```\n★ 𝞴 date\nWed 22 Jun 2022 12:56:22 AM EDT\n pawan  : [ruby-3.1.2] : [troml] on main *%\n★ 𝞴 bin/benchmark\nWarming up --------------------------------------\n             jm/toml     5.666B i/100ms\n               troml     1.091T i/100ms\nCalculating -------------------------------------\n             jm/toml    233.632B (±26.6%) i/s -      1.065T in   5.008150s\n               troml      9.958Q (±18.5%) i/s -     46.181Q in   4.967881s\n\nComparison:\n               troml: 9957828005865654.0 i/s\n             jm/toml: 233631820362.5 i/s - 42621.88x  (± 0.00) slower\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nPlease note that this is a side project. That means that I can and will only dedicate time to it when I have the will to. I guarantee no SLOs for support, looking at issues or merging PRs. I will pay attention to security vulnerabilities where necessary. Please bear this in mind when evaluating this gem for production use.\n\nThat being said, bug reports and pull requests are welcome on GitHub at https://github.com/pawandubey/troml. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/pawandubey/troml/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Troml project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/pawandubey/troml/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawandubey%2Ftroml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpawandubey%2Ftroml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawandubey%2Ftroml/lists"}