minting 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +43 -5
- data/Rakefile +5 -7
- data/lib/minting/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9506e71f742812607fef378d4df90eaea6d2457f0d818b55b6e06b6167fa6876
|
|
4
|
+
data.tar.gz: 99b200de879dfb9ed4eaec21b02067a886c01d48116fcb669ca70b5dbf314264
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01b120551584f7f6327f2db19731367dd091bfb3e7b9db91d98cd2ff0b7e1db41d4c190acc66d8cd611fe7689ddb8872b89bebe9db6506e267df121c60fbe6f1
|
|
7
|
+
data.tar.gz: 8cc6a7ffc780a555276298432de7c2929c5ffddadc4fc28b379a8c58245b70672a777e610e464b6ea485583a8b65eb7463b37e29ff422b9e065ecd1f565cb85a
|
data/README.md
CHANGED
|
@@ -192,11 +192,6 @@ This gem includes a performance suite under `test/performance`:
|
|
|
192
192
|
- Memory and GC pressure tests
|
|
193
193
|
- Competitive benchmarks vs `money` gem
|
|
194
194
|
|
|
195
|
-
On a typical machine, reference numbers are:
|
|
196
|
-
|
|
197
|
-
- Money creation: ~1.6M ops/sec
|
|
198
|
-
- Addition: ~1.7M ops/sec
|
|
199
|
-
|
|
200
195
|
Run locally:
|
|
201
196
|
|
|
202
197
|
```bash
|
|
@@ -210,6 +205,49 @@ BENCH=true rake bench:competitive
|
|
|
210
205
|
rake bench:regression
|
|
211
206
|
```
|
|
212
207
|
|
|
208
|
+
## Benchmark Summary: Minting vs Money Gem
|
|
209
|
+
|
|
210
|
+
Generated by Qwen from the latest benchmark run on Ruby 4.0.1. - 2026-05-30
|
|
211
|
+
|
|
212
|
+
### Key Takeaways
|
|
213
|
+
|
|
214
|
+
- **Mint is consistently faster** than the Money gem across all measured operations.
|
|
215
|
+
- **Mint is 2.28x faster** in the 50,000-transaction simulation.
|
|
216
|
+
- **Mint object creation is 2.76x faster** than `Money.from_amount`.
|
|
217
|
+
- In formatting and conversion, Mint is often **10+x **.
|
|
218
|
+
- Mint’s performance advantage is especially strong for numeric conversion, string formatting, comparisons, and high-volume transaction loops.
|
|
219
|
+
|
|
220
|
+
### Performance Highlights
|
|
221
|
+
|
|
222
|
+
| Category | Mint | Money | Approx. Ratio |
|
|
223
|
+
| --- | --- | --- | --- |
|
|
224
|
+
| High-volume transactions | 195,412 ops/sec | 85,882 ops/sec | 2.28x faster |
|
|
225
|
+
| `Mint.money` creation | 1.14M ops/sec | — | 2.76x faster than `Money.from_amount` |
|
|
226
|
+
| `some.dollars` creation | 990k ops/sec | — | 1.15x faster than `Mint.money` |
|
|
227
|
+
| `Money.new` creation | — | 715k ops/sec | Mint 1.59x faster |
|
|
228
|
+
| `to_f` formatting | 8.8M–9.3M ops/sec | 0.7M ops/sec | ~12x faster |
|
|
229
|
+
| `to_d` conversion | 2.1M–2.3M ops/sec | 0.73M–0.79M ops/sec | ~3x faster |
|
|
230
|
+
| `to_s` formatting | 300k–420k ops/sec | 109k–132k ops/sec | ~3x faster |
|
|
231
|
+
| `inspect` formatting | ~2.6–2.9M ops/sec | ~1.1–1.16M ops/sec | ~2.5x faster |
|
|
232
|
+
| `to_json` formatting | ~2.0–2.2M ops/sec | ~110k–126k ops/sec | ~17x faster |
|
|
233
|
+
| Currency lookup `Mint.currency('USD')` | 3.82M ops/sec | — | 1.60x faster than `Money::Currency.new` |
|
|
234
|
+
| Currency lookup `Money::Currency.find('USD')` | 3.63M ops/sec | 1.67M ops/sec | 2.29x faster |
|
|
235
|
+
| Addition | 1.11M ops/sec | 0.37M ops/sec | 3.0x faster |
|
|
236
|
+
| Subtraction | 1.11M ops/sec | 0.36M ops/sec | 3.0x faster |
|
|
237
|
+
| Multiplication | 1.28M ops/sec | 0.51M ops/sec | 2.5x faster |
|
|
238
|
+
| Division | 1.04M ops/sec | 0.37M ops/sec | 2.8x faster |
|
|
239
|
+
| Ratio division | 2.94M ops/sec | 0.39M ops/sec | 7.6x faster |
|
|
240
|
+
| Comparison (`==`, `<`, `>`) | 2.5M–4.1M ops/sec | 0.35M–0.38M ops/sec | 7x–10x faster |
|
|
241
|
+
| Allocation (`Mint.allocate`) | 279k ops/sec | 146k ops/sec | 1.9x faster |
|
|
242
|
+
| Split (`Mint.split`) | 215k ops/sec | 85k ops/sec | 3.3x faster |
|
|
243
|
+
|
|
244
|
+
### Commands Used
|
|
245
|
+
|
|
246
|
+
```sh
|
|
247
|
+
BENCH=true bundle exec ruby -Ilib:test -r ./test/test_helper.rb test/performance/competitive_performance_benchmark.rb
|
|
248
|
+
BENCH=true bundle exec ruby -Ilib:test -r ./test/test_helper.rb test/performance/competitive_memory_benchmark.rb
|
|
249
|
+
```
|
|
250
|
+
|
|
213
251
|
## License
|
|
214
252
|
|
|
215
253
|
MIT
|
data/Rakefile
CHANGED
|
@@ -14,16 +14,16 @@ end
|
|
|
14
14
|
|
|
15
15
|
Rake::TestTask.new(:bench) do |t|
|
|
16
16
|
t.libs = %w[lib test]
|
|
17
|
-
t.pattern = 'test
|
|
17
|
+
t.pattern = 'test/performance/*_benchmark.rb'
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
Rake::TestTask.new('bench:performance') do |t|
|
|
20
|
+
Rake::TestTask.new('bench:edge') do |t|
|
|
22
21
|
t.libs = %w[lib test]
|
|
23
|
-
t.pattern = 'test/performance
|
|
22
|
+
t.pattern = 'test/performance/algorithm_benchmark.rb'
|
|
24
23
|
t.ruby_opts << '-r test_helper.rb'
|
|
25
24
|
end
|
|
26
25
|
|
|
26
|
+
|
|
27
27
|
Rake::TestTask.new('bench:regression') do |t|
|
|
28
28
|
t.libs = %w[lib test]
|
|
29
29
|
t.pattern = 'test/performance/regression_benchmark.rb'
|
|
@@ -32,12 +32,10 @@ end
|
|
|
32
32
|
|
|
33
33
|
Rake::TestTask.new('bench:competitive') do |t|
|
|
34
34
|
t.libs = %w[lib test]
|
|
35
|
-
t.pattern = 'test/performance/
|
|
35
|
+
t.pattern = 'test/performance/competitive_performance_benchmark.rb'
|
|
36
36
|
t.ruby_opts << '-r test_helper.rb'
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
task 'bench:all' => ['bench', 'bench:performance']
|
|
40
|
-
|
|
41
39
|
RuboCop::RakeTask.new(:cop)
|
|
42
40
|
|
|
43
41
|
YARD::Rake::YardocTask.new do |t|
|
data/lib/minting/version.rb
CHANGED