Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

place work-stealing queue indices on different cache lines to avoid false-sharing #52994

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

d-netto
Copy link
Member

@d-netto d-netto commented Jan 21, 2024

For some reason this only shows up in the many_refs.jl benchmark, since it's the only one that hammers the work-stealing queue (we also didn't test this benchmark on a large number of GC threads in our previous analysis).

  • master:
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4268 │    3243 │      3048 │        194 │         1126 │                15 │      868 │         76 │
│  median │       4270 │    3246 │      3051 │        195 │         1128 │                17 │      868 │         76 │
│ maximum │       4278 │    3247 │      3052 │        195 │         1128 │                18 │      868 │         76 │
│   stdev │          5 │       2 │         2 │          0 │            1 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2728 │    1692 │      1551 │        141 │          598 │                23 │      868 │         62 │
│  median │       2732 │    1709 │      1567 │        141 │          603 │                23 │      868 │         62 │
│ maximum │       2744 │    1712 │      1571 │        143 │          607 │                24 │      868 │         63 │
│   stdev │          6 │       9 │         9 │          1 │            4 │                 0 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2105 │    1082 │       987 │         95 │          405 │                23 │      875 │         51 │
│  median │       2115 │    1089 │       994 │         95 │          409 │                23 │      875 │         52 │
│ maximum │       2127 │    1100 │      1003 │         97 │          417 │                25 │      875 │         52 │
│   stdev │          8 │       8 │         7 │          1 │            5 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       3861 │    2755 │      2676 │         79 │         1301 │                22 │      878 │         68 │
│  median │       3864 │    2835 │      2756 │         80 │         1342 │                25 │      879 │         73 │
│ maximum │       4032 │    2877 │      2797 │         80 │         1378 │                26 │      880 │         74 │
│   stdev │         73 │      45 │        45 │          1 │           28 │                 2 │        1 │          2 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       7455 │    6425 │      6344 │         80 │         3262 │                24 │      882 │         86 │
│  median │       7703 │    6682 │      6602 │         81 │         3313 │                25 │      884 │         87 │
│ maximum │       7826 │    6806 │      6725 │         81 │         3422 │                27 │      887 │         87 │
│   stdev │        152 │     153 │       153 │          0 │           68 │                 1 │        2 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
  • PR:
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4264 │    3240 │      3048 │        192 │         1127 │                15 │      868 │         76 │
│  median │       4271 │    3244 │      3052 │        192 │         1129 │                17 │      868 │         76 │
│ maximum │       4514 │    3481 │      3289 │        193 │         1247 │                18 │      868 │         77 │
│   stdev │        109 │     106 │       106 │          0 │           53 │                 1 │        0 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2712 │    1680 │      1541 │        138 │          591 │                22 │      868 │         62 │
│  median │       2713 │    1691 │      1552 │        140 │          594 │                24 │      868 │         62 │
│ maximum │       2732 │    1710 │      1569 │        141 │          606 │                25 │      868 │         63 │
│   stdev │         11 │      12 │        12 │          1 │            6 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2090 │    1057 │       962 │         95 │          398 │                22 │      874 │         50 │
│  median │       2103 │    1070 │       974 │         95 │          401 │                24 │      874 │         51 │
│ maximum │       2140 │    1074 │       978 │         96 │          402 │                25 │      875 │         51 │
│   stdev │         19 │       6 │         6 │          0 │            1 │                 1 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2236 │    1208 │      1129 │         79 │          528 │                23 │      880 │         54 │
│  median │       2238 │    1214 │      1135 │         79 │          533 │                23 │      880 │         54 │
│ maximum │       2246 │    1218 │      1138 │         80 │          534 │                35 │      880 │         54 │
│   stdev │          4 │       4 │         4 │          0 │            3 │                 5 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2326 │    1297 │      1216 │         80 │          595 │                24 │      884 │         56 │
│  median │       2348 │    1325 │      1245 │         80 │          620 │                25 │      885 │         56 │
│ maximum │       2370 │    1341 │      1262 │         81 │          631 │                26 │      887 │         57 │
│   stdev │         17 │      19 │        19 │          0 │           14 │                 1 │        1 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘

@d-netto d-netto added GC Garbage collector backport 1.10 Change should be backported to the 1.10 release labels Jan 21, 2024
@d-netto
Copy link
Member Author

d-netto commented Jan 21, 2024

Note: this was tested on x86_64.

It seems like the M2, for instance, has a cache-line of 128-bytes, so we might need to increase the padding size on this platform.

@d-netto d-netto force-pushed the dcn-false-sharing-on-queue-idx branch from f59e7bd to 5bf4411 Compare January 21, 2024 20:19
@gbaraldi
Copy link
Member

Now I'm worried if we're not suffering from this elsewhere, since we've found it in two places.

@gbaraldi
Copy link
Member

Adding extra padding makes a big difference in the m1

@oscardssmith
Copy link
Member

Is there anything usefull we should be putting in the padding?

src/work-stealing-queue.h Outdated Show resolved Hide resolved
@d-netto d-netto force-pushed the dcn-false-sharing-on-queue-idx branch 2 times, most recently from fd2c1b8 to 1b21a32 Compare January 22, 2024 23:46
@d-netto
Copy link
Member Author

d-netto commented Jan 22, 2024

Not sure if I'm using _Alignas incorrectly, but I tested two small variations on how we can introduce padding between top/bottom and they seem to cause a measurable difference in GC time at 8 threads on my M2:

- patch 1:

diff --git a/src/work-stealing-queue.h b/src/work-stealing-queue.h
index 38429e0288..2ff80f9f91 100644
--- a/src/work-stealing-queue.h
+++ b/src/work-stealing-queue.h
@@ -36,7 +36,7 @@ static inline ws_array_t *create_ws_array(size_t capacity, int32_t eltsz) JL_NOT
 
 typedef struct {
     _Atomic(int64_t) top;
-    _Atomic(int64_t) bottom;
+    _Alignas(128) _Atomic(int64_t) bottom; // put on a separate cache line. conservatively estimate cache line size as 128 bytes
     _Atomic(ws_array_t *) array;
 } ws_queue_t;
../julia-master/julia --project=. run_benchmarks.jl serial obj_arrays many_refs -n5 --scale=8
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       1183 │     847 │       789 │         58 │          276 │                10 │      860 │         71 │
│  median │       1214 │     866 │       808 │         59 │          286 │                13 │      867 │         72 │
│ maximum │       1242 │     876 │       816 │         60 │          287 │                17 │      870 │         72 │
│   stdev │         21 │      11 │        10 │          1 │            4 │                 2 │        4 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │        819 │     476 │       430 │         46 │          153 │                15 │      877 │         58 │
│  median │        864 │     517 │       447 │         69 │          173 │                17 │      878 │         60 │
│ maximum │        917 │     568 │       498 │         76 │          196 │                23 │      878 │         62 │
│   stdev │         35 │      33 │        27 │         12 │           16 │                 3 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │        837 │     499 │       453 │         45 │          203 │                17 │      890 │         60 │
│  median │        855 │     509 │       460 │         48 │          211 │                21 │      891 │         60 │
│ maximum │        882 │     545 │       499 │         49 │          228 │                22 │      892 │         62 │
│   stdev │         18 │      20 │        20 │          2 │           10 │                 2 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       1035 │     698 │       661 │         37 │          318 │                21 │      892 │         67 │
│  median │       1047 │     709 │       672 │         38 │          329 │                23 │      894 │         68 │
│ maximum │       1061 │     722 │       682 │         40 │          338 │                30 │      896 │         68 │
│   stdev │          9 │       9 │         8 │          1 │            8 │                 4 │        2 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘

- patch 2:

diff --git a/src/work-stealing-queue.h b/src/work-stealing-queue.h
index 38429e0288..084e421fd5 100644
--- a/src/work-stealing-queue.h
+++ b/src/work-stealing-queue.h
@@ -36,7 +36,8 @@ static inline ws_array_t *create_ws_array(size_t capacity, int32_t eltsz) JL_NOT
 
 typedef struct {
     _Atomic(int64_t) top;
-    _Atomic(int64_t) bottom;
+    char _padding[128 - sizeof(int64_t)];
+    _Atomic(int64_t) bottom; // put on a separate cache line. conservatively estimate cache line size as 128 bytes
     _Atomic(ws_array_t *) array;
 } ws_queue_t;
../julia-master/julia --project=. run_benchmarks.jl serial obj_arrays many_refs -n5 --scale=8
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       1179 │     843 │       785 │         57 │          273 │                12 │      859 │         71 │
│  median │       1188 │     851 │       792 │         58 │          276 │                15 │      860 │         71 │
│ maximum │       1202 │     864 │       800 │         64 │          284 │                16 │      869 │         72 │
│   stdev │          9 │       9 │         6 │          3 │            4 │                 2 │        5 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │        829 │     489 │       420 │         70 │          161 │                18 │      878 │         59 │
│  median │        851 │     509 │       438 │         72 │          169 │                19 │      878 │         60 │
│ maximum │        861 │     520 │       443 │         78 │          172 │                29 │      880 │         60 │
│   stdev │         12 │      12 │         9 │          3 │            4 │                 5 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │        827 │     490 │       442 │         45 │          196 │                18 │      891 │         59 │
│  median │        830 │     492 │       447 │         48 │          199 │                20 │      891 │         60 │
│ maximum │        836 │     499 │       451 │         48 │          203 │                22 │      892 │         60 │
│   stdev │          4 │       4 │         4 │          1 │            3 │                 2 │        1 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │        962 │     624 │       586 │         38 │          283 │                18 │      890 │         65 │
│  median │        977 │     644 │       606 │         38 │          293 │                22 │      891 │         66 │
│ maximum │       1008 │     672 │       634 │         39 │          309 │                34 │      894 │         67 │
│   stdev │         19 │      20 │        20 │          0 │           11 │                 6 │        2 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘

@d-netto d-netto force-pushed the dcn-false-sharing-on-queue-idx branch from 1b21a32 to 77871a8 Compare January 22, 2024 23:57
@vchuravy
Copy link
Sponsor Member

You can look at the difference in resulting struct layout here https://godbolt.org/z/a6Mq5sf1P

@d-netto d-netto force-pushed the dcn-false-sharing-on-queue-idx branch from 77871a8 to 735a887 Compare January 23, 2024 08:34
@d-netto d-netto merged commit 9f36490 into master Jan 23, 2024
5 of 7 checks passed
@d-netto d-netto deleted the dcn-false-sharing-on-queue-idx branch January 23, 2024 12:20
d-netto added a commit to RelationalAI/julia that referenced this pull request Jan 23, 2024
…alse-sharing (JuliaLang#52994)

For some reason this only shows up in the `many_refs.jl` benchmark,
since it's the only one that hammers the work-stealing queue (we also
didn't test this benchmark on a large number of GC threads in our
[previous
analysis](JuliaLang#48600 (comment))).

- master:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4268 │    3243 │      3048 │        194 │         1126 │                15 │      868 │         76 │
│  median │       4270 │    3246 │      3051 │        195 │         1128 │                17 │      868 │         76 │
│ maximum │       4278 │    3247 │      3052 │        195 │         1128 │                18 │      868 │         76 │
│   stdev │          5 │       2 │         2 │          0 │            1 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2728 │    1692 │      1551 │        141 │          598 │                23 │      868 │         62 │
│  median │       2732 │    1709 │      1567 │        141 │          603 │                23 │      868 │         62 │
│ maximum │       2744 │    1712 │      1571 │        143 │          607 │                24 │      868 │         63 │
│   stdev │          6 │       9 │         9 │          1 │            4 │                 0 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2105 │    1082 │       987 │         95 │          405 │                23 │      875 │         51 │
│  median │       2115 │    1089 │       994 │         95 │          409 │                23 │      875 │         52 │
│ maximum │       2127 │    1100 │      1003 │         97 │          417 │                25 │      875 │         52 │
│   stdev │          8 │       8 │         7 │          1 │            5 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       3861 │    2755 │      2676 │         79 │         1301 │                22 │      878 │         68 │
│  median │       3864 │    2835 │      2756 │         80 │         1342 │                25 │      879 │         73 │
│ maximum │       4032 │    2877 │      2797 │         80 │         1378 │                26 │      880 │         74 │
│   stdev │         73 │      45 │        45 │          1 │           28 │                 2 │        1 │          2 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       7455 │    6425 │      6344 │         80 │         3262 │                24 │      882 │         86 │
│  median │       7703 │    6682 │      6602 │         81 │         3313 │                25 │      884 │         87 │
│ maximum │       7826 │    6806 │      6725 │         81 │         3422 │                27 │      887 │         87 │
│   stdev │        152 │     153 │       153 │          0 │           68 │                 1 │        2 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```

- PR:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4264 │    3240 │      3048 │        192 │         1127 │                15 │      868 │         76 │
│  median │       4271 │    3244 │      3052 │        192 │         1129 │                17 │      868 │         76 │
│ maximum │       4514 │    3481 │      3289 │        193 │         1247 │                18 │      868 │         77 │
│   stdev │        109 │     106 │       106 │          0 │           53 │                 1 │        0 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2712 │    1680 │      1541 │        138 │          591 │                22 │      868 │         62 │
│  median │       2713 │    1691 │      1552 │        140 │          594 │                24 │      868 │         62 │
│ maximum │       2732 │    1710 │      1569 │        141 │          606 │                25 │      868 │         63 │
│   stdev │         11 │      12 │        12 │          1 │            6 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2090 │    1057 │       962 │         95 │          398 │                22 │      874 │         50 │
│  median │       2103 │    1070 │       974 │         95 │          401 │                24 │      874 │         51 │
│ maximum │       2140 │    1074 │       978 │         96 │          402 │                25 │      875 │         51 │
│   stdev │         19 │       6 │         6 │          0 │            1 │                 1 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2236 │    1208 │      1129 │         79 │          528 │                23 │      880 │         54 │
│  median │       2238 │    1214 │      1135 │         79 │          533 │                23 │      880 │         54 │
│ maximum │       2246 │    1218 │      1138 │         80 │          534 │                35 │      880 │         54 │
│   stdev │          4 │       4 │         4 │          0 │            3 │                 5 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2326 │    1297 │      1216 │         80 │          595 │                24 │      884 │         56 │
│  median │       2348 │    1325 │      1245 │         80 │          620 │                25 │      885 │         56 │
│ maximum │       2370 │    1341 │      1262 │         81 │          631 │                26 │      887 │         57 │
│   stdev │         17 │      19 │        19 │          0 │           14 │                 1 │        1 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```
DelveCI pushed a commit to RelationalAI/julia that referenced this pull request Jan 24, 2024
…alse-sharing (JuliaLang#52994)

For some reason this only shows up in the `many_refs.jl` benchmark,
since it's the only one that hammers the work-stealing queue (we also
didn't test this benchmark on a large number of GC threads in our
[previous
analysis](JuliaLang#48600 (comment))).

- master:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4268 │    3243 │      3048 │        194 │         1126 │                15 │      868 │         76 │
│  median │       4270 │    3246 │      3051 │        195 │         1128 │                17 │      868 │         76 │
│ maximum │       4278 │    3247 │      3052 │        195 │         1128 │                18 │      868 │         76 │
│   stdev │          5 │       2 │         2 │          0 │            1 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2728 │    1692 │      1551 │        141 │          598 │                23 │      868 │         62 │
│  median │       2732 │    1709 │      1567 │        141 │          603 │                23 │      868 │         62 │
│ maximum │       2744 │    1712 │      1571 │        143 │          607 │                24 │      868 │         63 │
│   stdev │          6 │       9 │         9 │          1 │            4 │                 0 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2105 │    1082 │       987 │         95 │          405 │                23 │      875 │         51 │
│  median │       2115 │    1089 │       994 │         95 │          409 │                23 │      875 │         52 │
│ maximum │       2127 │    1100 │      1003 │         97 │          417 │                25 │      875 │         52 │
│   stdev │          8 │       8 │         7 │          1 │            5 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       3861 │    2755 │      2676 │         79 │         1301 │                22 │      878 │         68 │
│  median │       3864 │    2835 │      2756 │         80 │         1342 │                25 │      879 │         73 │
│ maximum │       4032 │    2877 │      2797 │         80 │         1378 │                26 │      880 │         74 │
│   stdev │         73 │      45 │        45 │          1 │           28 │                 2 │        1 │          2 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       7455 │    6425 │      6344 │         80 │         3262 │                24 │      882 │         86 │
│  median │       7703 │    6682 │      6602 │         81 │         3313 │                25 │      884 │         87 │
│ maximum │       7826 │    6806 │      6725 │         81 │         3422 │                27 │      887 │         87 │
│   stdev │        152 │     153 │       153 │          0 │           68 │                 1 │        2 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```

- PR:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4264 │    3240 │      3048 │        192 │         1127 │                15 │      868 │         76 │
│  median │       4271 │    3244 │      3052 │        192 │         1129 │                17 │      868 │         76 │
│ maximum │       4514 │    3481 │      3289 │        193 │         1247 │                18 │      868 │         77 │
│   stdev │        109 │     106 │       106 │          0 │           53 │                 1 │        0 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2712 │    1680 │      1541 │        138 │          591 │                22 │      868 │         62 │
│  median │       2713 │    1691 │      1552 │        140 │          594 │                24 │      868 │         62 │
│ maximum │       2732 │    1710 │      1569 │        141 │          606 │                25 │      868 │         63 │
│   stdev │         11 │      12 │        12 │          1 │            6 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2090 │    1057 │       962 │         95 │          398 │                22 │      874 │         50 │
│  median │       2103 │    1070 │       974 │         95 │          401 │                24 │      874 │         51 │
│ maximum │       2140 │    1074 │       978 │         96 │          402 │                25 │      875 │         51 │
│   stdev │         19 │       6 │         6 │          0 │            1 │                 1 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2236 │    1208 │      1129 │         79 │          528 │                23 │      880 │         54 │
│  median │       2238 │    1214 │      1135 │         79 │          533 │                23 │      880 │         54 │
│ maximum │       2246 │    1218 │      1138 │         80 │          534 │                35 │      880 │         54 │
│   stdev │          4 │       4 │         4 │          0 │            3 │                 5 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2326 │    1297 │      1216 │         80 │          595 │                24 │      884 │         56 │
│  median │       2348 │    1325 │      1245 │         80 │          620 │                25 │      885 │         56 │
│ maximum │       2370 │    1341 │      1262 │         81 │          631 │                26 │      887 │         57 │
│   stdev │         17 │      19 │        19 │          0 │           14 │                 1 │        1 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```
KristofferC pushed a commit that referenced this pull request Jan 24, 2024
…alse-sharing (#52994)

For some reason this only shows up in the `many_refs.jl` benchmark,
since it's the only one that hammers the work-stealing queue (we also
didn't test this benchmark on a large number of GC threads in our
[previous
analysis](#48600 (comment))).

- master:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4268 │    3243 │      3048 │        194 │         1126 │                15 │      868 │         76 │
│  median │       4270 │    3246 │      3051 │        195 │         1128 │                17 │      868 │         76 │
│ maximum │       4278 │    3247 │      3052 │        195 │         1128 │                18 │      868 │         76 │
│   stdev │          5 │       2 │         2 │          0 │            1 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2728 │    1692 │      1551 │        141 │          598 │                23 │      868 │         62 │
│  median │       2732 │    1709 │      1567 │        141 │          603 │                23 │      868 │         62 │
│ maximum │       2744 │    1712 │      1571 │        143 │          607 │                24 │      868 │         63 │
│   stdev │          6 │       9 │         9 │          1 │            4 │                 0 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2105 │    1082 │       987 │         95 │          405 │                23 │      875 │         51 │
│  median │       2115 │    1089 │       994 │         95 │          409 │                23 │      875 │         52 │
│ maximum │       2127 │    1100 │      1003 │         97 │          417 │                25 │      875 │         52 │
│   stdev │          8 │       8 │         7 │          1 │            5 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       3861 │    2755 │      2676 │         79 │         1301 │                22 │      878 │         68 │
│  median │       3864 │    2835 │      2756 │         80 │         1342 │                25 │      879 │         73 │
│ maximum │       4032 │    2877 │      2797 │         80 │         1378 │                26 │      880 │         74 │
│   stdev │         73 │      45 │        45 │          1 │           28 │                 2 │        1 │          2 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       7455 │    6425 │      6344 │         80 │         3262 │                24 │      882 │         86 │
│  median │       7703 │    6682 │      6602 │         81 │         3313 │                25 │      884 │         87 │
│ maximum │       7826 │    6806 │      6725 │         81 │         3422 │                27 │      887 │         87 │
│   stdev │        152 │     153 │       153 │          0 │           68 │                 1 │        2 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```

- PR:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4264 │    3240 │      3048 │        192 │         1127 │                15 │      868 │         76 │
│  median │       4271 │    3244 │      3052 │        192 │         1129 │                17 │      868 │         76 │
│ maximum │       4514 │    3481 │      3289 │        193 │         1247 │                18 │      868 │         77 │
│   stdev │        109 │     106 │       106 │          0 │           53 │                 1 │        0 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2712 │    1680 │      1541 │        138 │          591 │                22 │      868 │         62 │
│  median │       2713 │    1691 │      1552 │        140 │          594 │                24 │      868 │         62 │
│ maximum │       2732 │    1710 │      1569 │        141 │          606 │                25 │      868 │         63 │
│   stdev │         11 │      12 │        12 │          1 │            6 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2090 │    1057 │       962 │         95 │          398 │                22 │      874 │         50 │
│  median │       2103 │    1070 │       974 │         95 │          401 │                24 │      874 │         51 │
│ maximum │       2140 │    1074 │       978 │         96 │          402 │                25 │      875 │         51 │
│   stdev │         19 │       6 │         6 │          0 │            1 │                 1 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2236 │    1208 │      1129 │         79 │          528 │                23 │      880 │         54 │
│  median │       2238 │    1214 │      1135 │         79 │          533 │                23 │      880 │         54 │
│ maximum │       2246 │    1218 │      1138 │         80 │          534 │                35 │      880 │         54 │
│   stdev │          4 │       4 │         4 │          0 │            3 │                 5 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2326 │    1297 │      1216 │         80 │          595 │                24 │      884 │         56 │
│  median │       2348 │    1325 │      1245 │         80 │          620 │                25 │      885 │         56 │
│ maximum │       2370 │    1341 │      1262 │         81 │          631 │                26 │      887 │         57 │
│   stdev │         17 │      19 │        19 │          0 │           14 │                 1 │        1 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```

(cherry picked from commit 9f36490)
@KristofferC KristofferC mentioned this pull request Jan 24, 2024
33 tasks
@oscardssmith oscardssmith added the performance Must go faster label Feb 5, 2024
KristofferC added a commit that referenced this pull request Feb 6, 2024
Backported PRs:
- [x] #51095 <!-- Fix edge cases where inexact conversions to UInt don't
throw -->
- [x] #52583 <!-- Don't access parent of triangular matrix in powm -->
- [x] #52645 <!-- update --gcthreads section in command line options -->
- [x] #52423 <!-- update nthreads info in versioninfo -->
- [x] #52721 <!-- inference: Guard TypeVar special case against vararg
-->
- [x] #52637 <!-- fix finding bundled stdlibs even if they are e.g.
devved in an environment higher in the load path -->
- [x] #52752 <!-- staticdata: handle cycles in datatypes -->
- [x] #52758 <!-- use a Dict instead of an IdDict for caching of the
`cwstring` for Windows env variables -->
- [x] #51375 <!-- Insert hardcoded backlinks to stdlib doc pages -->
- [x] #52994 <!-- place work-stealing queue indices on different cache
lines to avoid false-sharing -->
- [x] #53015 <!-- Add type assertion in iterate for logicalindex -->
- [x] #53032 <!-- Fix a list in GC devdocs -->
- [x] #52748 
- [x] #52856 
- [x] #52878
- [x] #52754 
- [x] #52228
- [x] #52924
- [x] #52569 <!-- Fix GC rooting during rehashing of iddict -->
- [x] #52605 <!-- Default uplo in symmetric/hermitian -->
- [x] #52618 <!-- heap snapshot: add gc roots and gc finalist roots to
fix unrooted nodes -->
- [x] #52781 <!-- fix type-stability bugs in Ryu code -->
- [x] #53055 <!-- Profile: use full terminal cols to show function name
-->
- [x] #53096 
- [x] #53076 
- [x] #52841 <!-- Extensions: make loading of extensions independent of
what packages are in the sysimage -->
- [x] #52078 <!-- Replace `&hArr;` by `&harr;` in documentation -->
- [x] #53035 <!-- use proper cache-line size variable in work-stealing
queue -->
- [x] #53066 <!-- doc: replace harr HTML entity by unicode -->
- [x] #52996 <!-- Apple silicon has 128 byte alignment so fix our
defines to match -->
- [x] #53121 

Non-merged PRs with backport label:
- [ ] #52694 <!-- Reinstate similar for AbstractQ for backward
compatibility -->
- [ ] #51479 <!-- prevent code loading from lookin in the versioned
environment when building Julia -->
@KristofferC KristofferC removed the backport 1.10 Change should be backported to the 1.10 release label Feb 6, 2024
Drvi pushed a commit to RelationalAI/julia that referenced this pull request Jun 7, 2024
…alse-sharing (JuliaLang#52994)

For some reason this only shows up in the `many_refs.jl` benchmark,
since it's the only one that hammers the work-stealing queue (we also
didn't test this benchmark on a large number of GC threads in our
[previous
analysis](JuliaLang#48600 (comment))).

- master:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4268 │    3243 │      3048 │        194 │         1126 │                15 │      868 │         76 │
│  median │       4270 │    3246 │      3051 │        195 │         1128 │                17 │      868 │         76 │
│ maximum │       4278 │    3247 │      3052 │        195 │         1128 │                18 │      868 │         76 │
│   stdev │          5 │       2 │         2 │          0 │            1 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2728 │    1692 │      1551 │        141 │          598 │                23 │      868 │         62 │
│  median │       2732 │    1709 │      1567 │        141 │          603 │                23 │      868 │         62 │
│ maximum │       2744 │    1712 │      1571 │        143 │          607 │                24 │      868 │         63 │
│   stdev │          6 │       9 │         9 │          1 │            4 │                 0 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2105 │    1082 │       987 │         95 │          405 │                23 │      875 │         51 │
│  median │       2115 │    1089 │       994 │         95 │          409 │                23 │      875 │         52 │
│ maximum │       2127 │    1100 │      1003 │         97 │          417 │                25 │      875 │         52 │
│   stdev │          8 │       8 │         7 │          1 │            5 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       3861 │    2755 │      2676 │         79 │         1301 │                22 │      878 │         68 │
│  median │       3864 │    2835 │      2756 │         80 │         1342 │                25 │      879 │         73 │
│ maximum │       4032 │    2877 │      2797 │         80 │         1378 │                26 │      880 │         74 │
│   stdev │         73 │      45 │        45 │          1 │           28 │                 2 │        1 │          2 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       7455 │    6425 │      6344 │         80 │         3262 │                24 │      882 │         86 │
│  median │       7703 │    6682 │      6602 │         81 │         3313 │                25 │      884 │         87 │
│ maximum │       7826 │    6806 │      6725 │         81 │         3422 │                27 │      887 │         87 │
│   stdev │        152 │     153 │       153 │          0 │           68 │                 1 │        2 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```

- PR:
```
bench = "many_refs.jl"
(gcthreads, threads) = (1, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       4264 │    3240 │      3048 │        192 │         1127 │                15 │      868 │         76 │
│  median │       4271 │    3244 │      3052 │        192 │         1129 │                17 │      868 │         76 │
│ maximum │       4514 │    3481 │      3289 │        193 │         1247 │                18 │      868 │         77 │
│   stdev │        109 │     106 │       106 │          0 │           53 │                 1 │        0 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (2, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2712 │    1680 │      1541 │        138 │          591 │                22 │      868 │         62 │
│  median │       2713 │    1691 │      1552 │        140 │          594 │                24 │      868 │         62 │
│ maximum │       2732 │    1710 │      1569 │        141 │          606 │                25 │      868 │         63 │
│   stdev │         11 │      12 │        12 │          1 │            6 │                 1 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (4, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2090 │    1057 │       962 │         95 │          398 │                22 │      874 │         50 │
│  median │       2103 │    1070 │       974 │         95 │          401 │                24 │      874 │         51 │
│ maximum │       2140 │    1074 │       978 │         96 │          402 │                25 │      875 │         51 │
│   stdev │         19 │       6 │         6 │          0 │            1 │                 1 │        1 │          1 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (8, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2236 │    1208 │      1129 │         79 │          528 │                23 │      880 │         54 │
│  median │       2238 │    1214 │      1135 │         79 │          533 │                23 │      880 │         54 │
│ maximum │       2246 │    1218 │      1138 │         80 │          534 │                35 │      880 │         54 │
│   stdev │          4 │       4 │         4 │          0 │            3 │                 5 │        0 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
(gcthreads, threads) = (16, 1)
┌─────────┬────────────┬─────────┬───────────┬────────────┬──────────────┬───────────────────┬──────────┬────────────┐
│         │ total time │ gc time │ mark time │ sweep time │ max GC pause │ time to safepoint │ max heap │ percent gc │
│         │         ms │      ms │        ms │         ms │           ms │                us │       MB │          % │
├─────────┼────────────┼─────────┼───────────┼────────────┼──────────────┼───────────────────┼──────────┼────────────┤
│ minimum │       2326 │    1297 │      1216 │         80 │          595 │                24 │      884 │         56 │
│  median │       2348 │    1325 │      1245 │         80 │          620 │                25 │      885 │         56 │
│ maximum │       2370 │    1341 │      1262 │         81 │          631 │                26 │      887 │         57 │
│   stdev │         17 │      19 │        19 │          0 │           14 │                 1 │        1 │          0 │
└─────────┴────────────┴─────────┴───────────┴────────────┴──────────────┴───────────────────┴──────────┴────────────┘
```

(cherry picked from commit 9f36490)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GC Garbage collector performance Must go faster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants