lazy_init 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c3c12be25d5a45b0b5d70589b47c4335e8e610b809ee80647e0230c7778c6a5
4
- data.tar.gz: 50dcdd14ca0228e4c202cd886cb17c622c2b677e0cb041f8f39f36eb14bc08cb
3
+ metadata.gz: bfb12301d1b856a1e50ab4f9bf62f93fb81c1455bb97c96a7c3d99c46fcbd273
4
+ data.tar.gz: bfd48db641c3925a5334367c3a7f0244c90e621f367d2ba9c769ff2618bd85e3
5
5
  SHA512:
6
- metadata.gz: e7cfa817d7c404168dd8237410edd85453d71334b16b31dba4d63b2fecf5374080595c4db983798bddca2883704b8dc07639a861d8113fff4f7a24875bfb5340
7
- data.tar.gz: 4c8ff04962ac7b59f6ecb9749faa6993814749fa9d146fc2eb482ffb9059ab03facc84430ceef04c07afc3484c5c041e833b8429a0ab523c6c352eef86659148
6
+ metadata.gz: 60d4462685b13bb4be5028fb184c90ac5086370a6f994456a8137658660ead40fd19e6452d08697469a4b032ee6729c754b724fe873309872f067e4255f9ba49
7
+ data.tar.gz: 358f2f3c570b13ed62e37d541f641f71950784a32adb4533f80b6814f560b9bd4407477b56682afab40724f611a41fcc824f3f6c930c2e236ffb05cf8ab3e5ab
data/CHANGELOG.md CHANGED
@@ -1,10 +1,27 @@
1
+ # 0.2.0 (2025/25/07)
1
2
 
3
+ ### Added
4
+ - Ruby 3.0+ performance optimizations
5
+ - Eval-based method generation for 2x faster hot path
6
+ - Version-specific implementation selection
2
7
 
3
- ### 0.1.1 (2025/06/07)
8
+ ### Changed
9
+ - Significant performance improvements on Ruby 3.0+
10
+ - Internal RubyCapabilities module cleanup
11
+
12
+ ### Performance
13
+ - Hot path: 1.1x overhead (vs 4.5x on Ruby 2.6)
14
+ - 50% faster method generation on Ruby 3+
15
+
16
+ ## 0.1.2 (2025/11/07)
17
+
18
+ * Fix bug with missing yard documentation link
19
+
20
+ ## 0.1.1 (2025/06/07)
4
21
 
5
22
  * Added YARD configuration for automatic documentation generation
6
23
  * Enhanced code comments for better API documentation
7
24
 
8
- ### 0.1.0 (2025/06/07)
25
+ # 0.1.0 (2025/06/07)
9
26
 
10
27
  * Initial public release
data/README.md CHANGED
@@ -66,7 +66,7 @@ Or install it yourself as:
66
66
  ```
67
67
  ## Requirements:
68
68
 
69
- - Ruby 2.6 or higher
69
+ - Ruby 2.6 or higher (Ruby 3.0+ recommended for best performance)
70
70
  - No external dependencies
71
71
 
72
72
  ## Quick Start
@@ -89,6 +89,7 @@ client.connection # "Establishing connection..." - computed once
89
89
  client.connection # Returns cached result (thread-safe)
90
90
  ```
91
91
 
92
+
92
93
  ### With Dependencies
93
94
  ```ruby
94
95
  class WebService
@@ -529,15 +530,22 @@ LazyInit is optimized for production use:
529
530
  ```
530
531
  ## Performance
531
532
 
532
- Realistic benchmark results (x86_64-darwin19, Ruby 3.0.2):
533
+ Performance varies by Ruby version:
534
+
535
+ **Ruby 3.0+ (Recommended):**
536
+ - Hot path: 1.1-1.4x overhead
537
+ - Cold start: ~13-19x overhead
538
+ - Thread safety: Near-zero overhead
539
+
540
+ **Ruby 2.6-2.7:**
541
+ - Hot path: 4x overhead
542
+ - Use mainly for expensive operations or critical thread safety
533
543
 
534
- - Initial computation: ~identical (LazyInit setup overhead negligible)
535
- - Cached access: 3.5x slower than manual ||=
536
- -100,000 calls: Manual 13ms, LazyInit 45ms
537
- - In practice: For expensive operations (5-50ms), 0.0004ms per call overhead is negligible.
538
- - Trade-off: 3.5x cached access cost for 100% thread safety
544
+ **Benchmark Summary (Ruby 3.3.1):**
545
+ - Simple lazy attributes: ~10% overhead
546
+ - Complex dependencies: 4x overhead
547
+ - Thread safety: Better than manual synchronization
539
548
 
540
- [Full details can be found here](https://github.com/N3BCKN/lazy_init/blob/main/benchmarks/benchmark_performance.rb)
541
549
 
542
550
  ### Optimization Strategies
543
551
  LazyInit automatically selects the best implementation:
@@ -546,6 +554,16 @@ LazyInit automatically selects the best implementation:
546
554
  - Optimized dependency (single dependency): Balanced performance
547
555
  - Full LazyValue (complex scenarios): Full feature set
548
556
 
557
+ ### Ruby Version Comparison
558
+
559
+ | Ruby Version | Hot Path Overhead | Best Use Case |
560
+ |--------------|-------------------|---------------|
561
+ | 3.3.1 | 1.1x | Production ready everywhere |
562
+ | 3.0.2 | 1.4x | Production ready everywhere |
563
+ | 2.7.5 | 4.1x | Expensive operations mainly |
564
+ | 2.6.6 | 4.3x | Expensive operations mainly |
565
+
566
+
549
567
 
550
568
  ## Thread Safety
551
569
  LazyInit provides comprehensive thread safety guarantees: