Skip to content

chore: Reduce allocation of Lazy#650

Merged
stephenamar-db merged 1 commit intodatabricks:masterfrom
He-Pin:reduceLazyAllocation
Mar 16, 2026
Merged

chore: Reduce allocation of Lazy#650
stephenamar-db merged 1 commit intodatabricks:masterfrom
He-Pin:reduceLazyAllocation

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Mar 15, 2026

Motivation:
Use specialized Lazy to reduce the allocation of Lazy was #645


⏺ Final JMH Benchmark Comparison: master vs jit                                                      
   
  ┌───────────────────────┬────────────────┬─────────────┬────────┐                                  
  │       Benchmark       │ master (ms/op) │ jit (ms/op) │ Change │
  ├───────────────────────┼────────────────┼─────────────┼────────┤                                  
  │ assertions            │ 0.305          │ 0.302       │ -1.0%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.01              │ 0.073          │ 0.073       │ 0.0%   │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.02              │ 51.252         │ 47.703      │ -6.9%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.03              │ 14.250         │ 14.089      │ -1.1%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.04              │ 31.549         │ 31.787      │ +0.8%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.06              │ 0.445          │ 0.425       │ -4.5%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.07              │ 1188.786       │ 1110.849    │ -6.6%  │ NOT Valid because of StackOverFlow, fixed now
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.08              │ 0.058          │ 0.058       │ 0.0%   │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ bench.09              │ 0.066          │ 0.065       │ -1.5%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ gen_big_object        │ 1.073          │ 1.056       │ -1.6%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ large_string_join     │ 2.480          │ 2.174       │ -12.3% │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ large_string_template │ 2.315          │ 2.291       │ -1.0%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ realistic1            │ 3.104          │ 2.749       │ -11.4% │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ realistic2            │ 72.683         │ 67.321      │ -7.4%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ base64                │ 0.793          │ 0.809       │ +2.0%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ base64Decode          │ 0.596          │ 0.605       │ +1.5%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ base64DecodeBytes     │ 9.276          │ 9.207       │ -0.7%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ base64_byte_array     │ 1.434          │ 1.458       │ +1.7%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ comparison            │ 22.584         │ 23.068      │ +2.1%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ comparison2           │ 78.813         │ 73.607      │ -6.6%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ escapeStringJson      │ 0.049          │ 0.049       │ 0.0%   │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ foldl                 │ 9.781          │ 9.475       │ -3.1%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ lstripChars           │ 0.613          │ 0.612       │ -0.2%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ manifestJsonEx        │ 0.074          │ 0.070       │ -5.4%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ manifestTomlEx        │ 0.090          │ 0.086       │ -4.4%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ manifestYamlDoc       │ 0.075          │ 0.073       │ -2.7%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ member                │ 0.685          │ 0.731       │ +6.7%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ parseInt              │ 0.052          │ 0.051       │ -1.9%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ reverse               │ 10.933         │ 11.030      │ +0.9%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ rstripChars           │ 0.637          │ 0.620       │ -2.7%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ stripChars            │ 0.585          │ 0.595       │ +1.7%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ substr                │ 0.163          │ 0.163       │ 0.0%   │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ setDiff               │ 0.461          │ 0.449       │ -2.6%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ setInter              │ 0.411          │ 0.428       │ +4.1%  │
  ├───────────────────────┼────────────────┼─────────────┼────────┤
  │ setUnion              │ 0.734          │ 0.756       │ +3.0%  │
  └───────────────────────┴────────────────┴─────────────┴────────┘

chore: fix run bench of bench.07.jsonnet
@He-Pin
Copy link
Contributor Author

He-Pin commented Mar 15, 2026

@stephenamar-db I think this one is ready

@stephenamar-db stephenamar-db merged commit 3a39b43 into databricks:master Mar 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants