You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a summary of GC behavior while testing a web application which creates some cyclic trash. It is running with Python 3.11.1 and with this dynamic threshold PR logic. The dynamic version seems effective in reducing the time spent in GC and doesn't increase thresholds too much so there is a lot of cyclic trash wasting memory. IMHO, this idea could be worth pursuing. The high thresholds for gen1 and gen2 are too high, IMHO, since they are based on number of gen0 and gen1 collections, not #-of-objects. The magic constants (e.g. 10 and 5 in exponent = -((ratio - target)*10.0-5) probably need some tuning. The ratio of collected objects in gen0 jumps around on each collection. See some log output generated from gc_adapt_threshold below. The long term average ratio collected in gen0 is not approaching the target 0.2 and so maybe the adapt function needs some tweaking.
branch
gen
num collections
mean collected cycles
mean time [ns]
mean total objects
total time [s]
time per total [ns/obj]
time per collected [ns/obj]
ratio collected
main
0
16272
34
56,313
739
0.92
76
1653
5%
main
1
1478
995
726,633
4,827
1.07
151
730
21%
main
2
106
21,118
80,731,000
210,969
8.56
383
3823
10%
dynamic
0
2718
343
357,774
3,095
0.97
116
1042
11%
dynamic
1
163
15,153
7,458,847
24,406
1.22
306
492
62%
dynamic
2
10
91,193
147,900,000
282,123
1.48
524
1622
32%
gc threshold: gen 1 ratio 0.83 old 10 new 10
gc threshold: gen 0 ratio 0.05 old 2555 new 2627
gc threshold: gen 0 ratio 0.06 old 2627 new 2692
gc threshold: gen 0 ratio 0.12 old 2692 new 2726
gc threshold: gen 0 ratio 0.15 old 2726 new 2752
gc threshold: gen 0 ratio 0.14 old 2752 new 2778
gc threshold: gen 0 ratio 0.17 old 2778 new 2798
gc threshold: gen 0 ratio 0.76 old 2798 new 1446
gc threshold: gen 0 ratio 0.54 old 1446 new 1320
gc threshold: gen 0 ratio 0.41 old 1320 new 1286
gc threshold: gen 0 ratio 0.21 old 1286 new 1281
gc threshold: gen 0 ratio 0.49 old 1281 new 1218
gc threshold: gen 1 ratio 0.41 old 10 new 10
gc threshold: gen 0 ratio 0.18 old 1218 new 1247
gc threshold: gen 0 ratio 0.02 old 1247 new 1397
gc threshold: gen 0 ratio 0.13 old 1397 new 1446
gc threshold: gen 0 ratio 0.14 old 1446 new 1489
gc threshold: gen 0 ratio 0.14 old 1489 new 1531
gc threshold: gen 0 ratio 0.13 old 1531 new 1576
gc threshold: gen 0 ratio 0.14 old 1576 new 1618
gc threshold: gen 0 ratio 0.14 old 1618 new 1660
gc threshold: gen 0 ratio 0.14 old 1660 new 1700
gc threshold: gen 0 ratio 0.15 old 1700 new 1734
gc threshold: gen 0 ratio 0.70 old 1734 new 1206
gc threshold: gen 1 ratio 0.15 old 10 new 16
gc threshold: gen 0 ratio 0.46 old 1206 new 1164
gc threshold: gen 0 ratio 0.32 old 1164 new 1153
gc threshold: gen 0 ratio 0.54 old 1153 new 1075
gc threshold: gen 0 ratio 0.51 old 1075 new 1028
gc threshold: gen 0 ratio 0.56 old 1028 new 961
gc threshold: gen 0 ratio 0.58 old 961 new 900
gc threshold: gen 0 ratio 0.21 old 900 new 898
gc threshold: gen 0 ratio 0.07 old 898 new 999
gc threshold: gen 0 ratio 0.20 old 999 new 1026
gc threshold: gen 0 ratio 0.34 old 1026 new 1017
gc threshold: gen 0 ratio 0.35 old 1017 new 1007
gc threshold: gen 0 ratio 0.39 old 1007 new 993
gc threshold: gen 0 ratio 0.50 old 993 new 959
gc threshold: gen 0 ratio 0.45 old 959 new 939
gc threshold: gen 0 ratio 0.02 old 939 new 1103
gc threshold: gen 0 ratio 0.01 old 1103 new 1263
gc threshold: gen 0 ratio 0.12 old 1263 new 1318
gc threshold: gen 1 ratio 0.79 old 16 new 14
gc threshold: gen 0 ratio 0.04 old 1318 new 1437
gc threshold: gen 0 ratio 0.08 old 1437 new 1516
gc threshold: gen 0 ratio 0.03 old 1516 new 1645
gc threshold: gen 0 ratio 0.11 old 1645 new 1698
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.