Skip to content

Conversation

@1stub
Copy link
Collaborator

@1stub 1stub commented Jan 14, 2026

To prevent us from processing excessive decrements on the mutator thread, we now compute how many bytes we have freed during processAllocatorsPages and update the maximum decrement count accordingly. My current calculations for max_decrement_count are pretty generous --- I believe this calculation could be tightened.

I also fixed BSQ_INITIAL_MAX_DECREMENT_COUNT to represent the max possible number of objects needing to be rebuilt to prevent the allocator being starved from pages.

Before our performance on btrees was

Performance:
    Measurement        Mean          σ         Min         Max        50%         95%          99%
     Collection   2.51329ms   4.48894ms   167.371us   29.8567ms       542us     8.028ms    28.864ms
        Nursery   1.24734ms   1.70406ms     3.266us   5.20394ms       122us     4.308ms     4.788ms
         RC Old   984.063us   3.46946ms       0.4us   24.7172ms        18us      3.76ms    23.836ms
Statistics:
	Time Collecting   58.9596%
	Total Collections 1.468K
	Total Pages       44.193K
	Max Live Heap     268.227MB
	Heap Size         362.029MB
	Alloc Count       305.314M
	Alloc'd Memory    9.77005GB
	Survival Rate     30.8914%
	
real	0m5.331s
user	0m5.230s
sys	0m0.101s

And after making the number of decs dynamic

Performance:
    Measurement        Mean          σ         Min         Max        50%         95%          99%
     Collection    2.3018ms   4.08092ms   171.139us   28.2228ms       596us     7.226ms     26.38ms
        Nursery   1.38244ms   1.47766ms   168.724us   5.35276ms       520us     4.006ms      4.68ms
         RC Old   914.462us    3.2609ms     1.232us   23.3507ms        20us     3.544ms    22.438ms
Statistics:
	Time Collecting   57.0604%
	Total Collections 1.468K
	Total Pages       45.349K
	Max Live Heap     273.638MB
	Heap Size         371.499MB
	Alloc Count       305.302M
	Alloc'd Memory    9.76968GB
	Survival Rate     30.8897%

real	0m4.903s
user	0m4.840s
sys	0m0.066s

@1stub 1stub requested a review from marron-at-work January 14, 2026 21:55
@1stub 1stub merged commit 777b897 into BosqueLanguage:main Jan 14, 2026
1 check passed
@1stub 1stub deleted the 01_14_decs_throttling branch January 14, 2026 22:32
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