Skip to content

New/bitwise performance improvements#79

Merged
sentientforest merged 2 commits intoGalaChain:mainfrom
sentientforest:new/bitwise-performance-improvements
Feb 5, 2026
Merged

New/bitwise performance improvements#79
sentientforest merged 2 commits intoGalaChain:mainfrom
sentientforest:new/bitwise-performance-improvements

Conversation

@sentientforest
Copy link
Collaborator

@sentientforest sentientforest commented Feb 4, 2026

Sample benchmark output before optimizations:

===============================================================================================
                           BENCHMARK SUMMARY - processSwapSteps
===============================================================================================
Test                  Ticks   Iters   Total (ms)  Avg (ms)    Notes                    
-----------------------------------------------------------------------------------------------
Dense (100 ticks)     101     100     47.28       0.4728                               
Dense (500 ticks)     501     50      23.46       0.4693                               
Dense (1000 ticks)    1001    25      49.96       1.9986                               
Tick spacing 10       1001    25      108.47      4.3386      More granular            
Reverse direction     501     50      17.08       0.3416      zeroForOne=false         
Sparse distribution   41      100     33.72       0.3372      spacing=200              
Stress test           201     500     130.93      0.2619      3819 swaps/sec           
Tick crossings        2001    100     26.40       0.2640      Varying amounts          
EXTREME (500k range)  12501   1       901.24      901.2351    0.9s, ~50001 crossed     
NEAR-MAX RANGE        177435  3       38089.51    12696.5027  38s, 532302.1 total      
MAX DENSITY (100k)    10001   1       682.94      682.9355    0.7s, 10001 crossed      
Negative tick start   501     50      26.15       0.5229      start at -6000           
Cross-zero swap       201     50      28.49       0.5699      -6000 to +6000           
-----------------------------------------------------------------------------------------------
TOTAL                         1055    40165.62    38.0717     ~26 swaps/sec            
===============================================================================================

Sample benchmark run after bitwise improvements:

===============================================================================================
                           BENCHMARK SUMMARY - processSwapSteps
===============================================================================================
Test                  Ticks   Iters   Total (ms)  Avg (ms)    Notes                    
-----------------------------------------------------------------------------------------------
Dense (100 ticks)     101     100     41.11       0.4111                               
Dense (500 ticks)     501     50      18.79       0.3759                               
Dense (1000 ticks)    1001    25      42.20       1.6881                               
Tick spacing 10       1001    25      69.04       2.7614      More granular            
Reverse direction     501     50      15.97       0.3195      zeroForOne=false         
Sparse distribution   41      100     25.30       0.2530      spacing=200              
Stress test           201     500     94.80       0.1896      5274 swaps/sec           
Tick crossings        2001    100     19.78       0.1978      Varying amounts          
EXTREME (500k range)  12501   1       511.40      511.4010    0.5s, ~50001 crossed     
NEAR-MAX RANGE        177435  4       30721.44    7680.3601   31s, 709736.2 total      
MAX DENSITY (100k)    10001   1       389.45      389.4460    0.4s, 10001 crossed      
Negative tick start   501     50      22.10       0.4419      start at -6000           
Cross-zero swap       201     50      18.97       0.3794      -6000 to +6000           
-----------------------------------------------------------------------------------------------
TOTAL                         1056    31990.35    30.2939     ~33 swaps/sec            
===============================================================================================

@sentientforest sentientforest merged commit 62ac19b into GalaChain:main Feb 5, 2026
1 check 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