Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bryanp/b3bm
Base62 for Ruby
https://github.com/bryanp/b3bm
base62 ruby
Last synced: about 1 month ago
JSON representation
Base62 for Ruby
- Host: GitHub
- URL: https://github.com/bryanp/b3bm
- Owner: bryanp
- License: mpl-2.0
- Created: 2021-03-09T17:21:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-09T01:01:57.000Z (about 2 years ago)
- Last Synced: 2024-03-15T08:22:19.684Z (8 months ago)
- Topics: base62, ruby
- Language: Ruby
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# b3bm
Base62 for Ruby.
This library offers Base62 encoding/decoding using a methodology that is generally compatible with encodings from other
ecosystems. Unfortunately the approach is very inefficient. Just how inefficient is it? Well, here's a comparison
between `b3bm`, `base_x`, and Ruby's url-safe Base64 encoder:```
$ bundle exec ruby benchmarks/decode.rb
Warming up --------------------------------------
b3bm 105.000 i/100ms
base_x 97.000 i/100ms
base64 40.921k i/100ms
Calculating -------------------------------------
b3bm 1.079k (± 6.8%) i/s - 5.460k in 5.089545s
base_x 951.151 (± 4.9%) i/s - 4.753k in 5.010191s
base64 372.882k (±11.9%) i/s - 1.841M in 5.016939sComparison:
base64: 372881.6 i/s
b3bm: 1078.9 i/s - 345.61x (± 0.00) slower
base_x: 951.2 i/s - 392.03x (± 0.00) slower
```Use [`b3e`](https://github.com/bryanp/b3e) if you care about performance more than portability.