Skip to content

Commit 4e23a33

Browse files
author
Oren (electricessence)
committed
Updated reference to Open.Threading.Tasks (only used when trimming).
Updated benchmarks. ConcurrentQueue has fallen from grace?
1 parent 74e23e4 commit 4e23a33

5 files changed

Lines changed: 126 additions & 123 deletions

File tree

benchmarking/BenchmarkResult.csv

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
Batch,Pool Type," From Empty (In Parallel)"," To (In Parallel)",d Read/Write (In Parallel),y Pool (.TryTake()),L,
2-
Repeat 200000 for size 4,QueueObjectPool,00:00:01.0947249,00:00:00.9968247,00:00:00.9656608,00:00:00.1521333,00:00:03.2093437,
3-
Repeat 200000 for size 4,ConcurrentQueueObjectPool,00:00:01.1280539,00:00:01.0784355,00:00:01.0181790,00:00:00.1777503,00:00:03.4024187,
4-
Repeat 200000 for size 4,ConcurrentStackObjectPool,00:00:01.1002830,00:00:01.0578873,00:00:00.9720418,00:00:00.1441359,00:00:03.2743480,
5-
Repeat 200000 for size 4,OptimisticArrayObjectPool,00:00:01.0957806,00:00:00.9225542,00:00:00.8814923,00:00:00.1739174,00:00:03.0737445,
6-
Repeat 80000 for size 10,QueueObjectPool,00:00:00.5346130,00:00:00.5352514,00:00:00.4743420,00:00:00.1366686,00:00:01.6808750,
7-
Repeat 80000 for size 10,ConcurrentQueueObjectPool,00:00:00.5718558,00:00:00.5354731,00:00:00.5125773,00:00:00.1602205,00:00:01.7801267,
8-
Repeat 80000 for size 10,ConcurrentStackObjectPool,00:00:00.5552188,00:00:00.5154776,00:00:00.4801922,00:00:00.1249209,00:00:01.6758095,
9-
Repeat 80000 for size 10,OptimisticArrayObjectPool,00:00:00.5270367,00:00:00.4550340,00:00:00.4407644,00:00:00.2186592,00:00:01.6414943,
10-
Repeat 24000 for size 50,QueueObjectPool,00:00:00.2622830,00:00:00.4367957,00:00:00.2884833,00:00:00.1834193,00:00:01.1709813,
11-
Repeat 24000 for size 50,ConcurrentQueueObjectPool,00:00:00.2719027,00:00:00.2854846,00:00:00.2650888,00:00:00.2203011,00:00:01.0427772,
12-
Repeat 24000 for size 50,ConcurrentStackObjectPool,00:00:00.2640431,00:00:00.3351598,00:00:00.2996782,00:00:00.2149665,00:00:01.1138476,
13-
Repeat 24000 for size 50,OptimisticArrayObjectPool,00:00:00.3047471,00:00:00.3823836,00:00:00.2115898,00:00:00.8433052,00:00:01.7420257,
14-
Repeat 16000 for size 100,QueueObjectPool,00:00:00.2680744,00:00:00.4845459,00:00:00.3117290,00:00:00.2375035,00:00:01.3018528,
15-
Repeat 16000 for size 100,ConcurrentQueueObjectPool,00:00:00.2620082,00:00:00.2949254,00:00:00.2538674,00:00:00.2908684,00:00:01.1016694,
16-
Repeat 16000 for size 100,ConcurrentStackObjectPool,00:00:00.2735071,00:00:00.3903024,00:00:00.3434028,00:00:00.3366711,00:00:01.3438834,
17-
Repeat 16000 for size 100,OptimisticArrayObjectPool,00:00:00.7922812,00:00:00.6641963,00:00:00.2030016,00:00:01.7548815,00:00:03.4143606,
18-
Repeat 25600 for size 250,QueueObjectPool,00:00:00.7668417,00:00:01.8047414,00:00:01.3185354,00:00:00.8664007,00:00:04.7565192,
19-
Repeat 25600 for size 250,ConcurrentQueueObjectPool,00:00:00.8378978,00:00:00.9370109,00:00:00.7695238,00:00:01.0984692,00:00:03.6429017,
20-
Repeat 25600 for size 250,ConcurrentStackObjectPool,00:00:00.7848982,00:00:01.5942377,00:00:01.5995650,00:00:01.7959374,00:00:05.7746383,
21-
Repeat 25600 for size 250,OptimisticArrayObjectPool,00:00:01.2561773,00:00:03.2871367,00:00:00.5424299,00:00:12.0158755,00:00:17.1016194,
2+
Repeat 200000 for size 4,QueueObjectPool,00:00:00.6037240,00:00:00.5527088,00:00:00.5315828,00:00:00.0900567,00:00:01.7780723,
3+
Repeat 200000 for size 4,ConcurrentQueueObjectPool,00:00:00.6749691,00:00:00.6146747,00:00:00.6101963,00:00:00.0730119,00:00:01.9728520,
4+
Repeat 200000 for size 4,ConcurrentStackObjectPool,00:00:00.6205358,00:00:00.6441162,00:00:00.5418539,00:00:00.0758358,00:00:01.8823417,
5+
Repeat 200000 for size 4,OptimisticArrayObjectPool,00:00:00.6262788,00:00:00.5193854,00:00:00.5256468,00:00:00.0980145,00:00:01.7693255,
6+
Repeat 80000 for size 10,QueueObjectPool,00:00:00.4154226,00:00:00.3984580,00:00:00.3555039,00:00:00.1029956,00:00:01.2723801,
7+
Repeat 80000 for size 10,ConcurrentQueueObjectPool,00:00:00.4010665,00:00:00.3802531,00:00:00.3610812,00:00:00.0846055,00:00:01.2270063,
8+
Repeat 80000 for size 10,ConcurrentStackObjectPool,00:00:00.4181783,00:00:00.4003157,00:00:00.3933568,00:00:00.0930685,00:00:01.3049193,
9+
Repeat 80000 for size 10,OptimisticArrayObjectPool,00:00:00.4154931,00:00:00.3539234,00:00:00.3306813,00:00:00.1595689,00:00:01.2596667,
10+
Repeat 24000 for size 50,QueueObjectPool,00:00:00.1983285,00:00:00.5393018,00:00:00.2520056,00:00:00.1437719,00:00:01.1334078,
11+
Repeat 24000 for size 50,ConcurrentQueueObjectPool,00:00:00.1911597,00:00:00.6099586,00:00:00.2019195,00:00:00.1173744,00:00:01.1204122,
12+
Repeat 24000 for size 50,ConcurrentStackObjectPool,00:00:00.1947059,00:00:00.2563897,00:00:00.2213445,00:00:00.1613517,00:00:00.8337918,
13+
Repeat 24000 for size 50,OptimisticArrayObjectPool,00:00:00.2011463,00:00:00.2458962,00:00:00.1567710,00:00:00.5725949,00:00:01.1764084,
14+
Repeat 16000 for size 100,QueueObjectPool,00:00:00.1917082,00:00:00.7281393,00:00:00.4965600,00:00:00.1853762,00:00:01.6017837,
15+
Repeat 16000 for size 100,ConcurrentQueueObjectPool,00:00:00.1913408,00:00:00.5323921,00:00:06.1167135,00:00:00.3403016,00:00:07.1807480,
16+
Repeat 16000 for size 100,ConcurrentStackObjectPool,00:00:00.1864700,00:00:00.2674701,00:00:00.2333379,00:00:00.2567077,00:00:00.9439857,
17+
Repeat 16000 for size 100,OptimisticArrayObjectPool,00:00:00.2117531,00:00:00.3088107,00:00:00.1494503,00:00:01.2309936,00:00:01.9010077,
18+
Repeat 25600 for size 250,QueueObjectPool,00:00:00.4827432,00:00:02.6029248,00:00:02.6176686,00:00:00.6578479,00:00:06.3611845,
19+
Repeat 25600 for size 250,ConcurrentQueueObjectPool,00:00:00.7486876,00:00:35.1458453,00:00:59.9447445,00:00:05.0064751,00:01:40.8457525,
20+
Repeat 25600 for size 250,ConcurrentStackObjectPool,00:00:00.5360153,00:00:01.0427376,00:00:00.9601208,00:00:01.4689654,00:00:04.0078391,
21+
Repeat 25600 for size 250,OptimisticArrayObjectPool,00:00:00.9522035,00:00:02.1958969,00:00:00.4701271,00:00:10.4725119,00:00:14.0907394,
2222
Repeat 14400 for size 500,QueueObjectPool,00:00:00.7797824,00:00:01.6503887,00:00:01.3768657,00:00:00.8861150,00:00:04.6931518,
2323
Repeat 14400 for size 500,ConcurrentQueueObjectPool,00:00:00.7994849,00:00:00.9658497,00:00:00.7778244,00:00:01.1149906,00:00:03.6581496,
2424
Repeat 14400 for size 500,ConcurrentStackObjectPool,00:00:00.7487525,00:00:02.3665267,00:00:02.6608263,00:00:03.0226290,00:00:08.7987345,

benchmarking/BenchmarkResult.txt

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -2,159 +2,159 @@ Repeat 200000 for size 4
22
------------------------------------
33

44
QueueObjectPool.........................................
5-
00:00:01.0947249 Take From Empty (In Parallel)
6-
00:00:00.9968247 Give To (In Parallel)
7-
00:00:00.9656608 Mixed Read/Write (In Parallel)
8-
00:00:00.1521333 Empty Pool (.TryTake())
9-
00:00:03.2093437 TOTAL
5+
00:00:00.6037240 Take From Empty (In Parallel)
6+
00:00:00.5527088 Give To (In Parallel)
7+
00:00:00.5315828 Mixed Read/Write (In Parallel)
8+
00:00:00.0900567 Empty Pool (.TryTake())
9+
00:00:01.7780723 TOTAL
1010

1111
ConcurrentQueueObjectPool...............................
12-
00:00:01.1280539 Take From Empty (In Parallel)
13-
00:00:01.0784355 Give To (In Parallel)
14-
00:00:01.0181790 Mixed Read/Write (In Parallel)
15-
00:00:00.1777503 Empty Pool (.TryTake())
16-
00:00:03.4024187 TOTAL
12+
00:00:00.6749691 Take From Empty (In Parallel)
13+
00:00:00.6146747 Give To (In Parallel)
14+
00:00:00.6101963 Mixed Read/Write (In Parallel)
15+
00:00:00.0730119 Empty Pool (.TryTake())
16+
00:00:01.9728520 TOTAL
1717

1818
ConcurrentStackObjectPool...............................
19-
00:00:01.1002830 Take From Empty (In Parallel)
20-
00:00:01.0578873 Give To (In Parallel)
21-
00:00:00.9720418 Mixed Read/Write (In Parallel)
22-
00:00:00.1441359 Empty Pool (.TryTake())
23-
00:00:03.2743480 TOTAL
19+
00:00:00.6205358 Take From Empty (In Parallel)
20+
00:00:00.6441162 Give To (In Parallel)
21+
00:00:00.5418539 Mixed Read/Write (In Parallel)
22+
00:00:00.0758358 Empty Pool (.TryTake())
23+
00:00:01.8823417 TOTAL
2424

2525
OptimisticArrayObjectPool...............................
26-
00:00:01.0957806 Take From Empty (In Parallel)
27-
00:00:00.9225542 Give To (In Parallel)
28-
00:00:00.8814923 Mixed Read/Write (In Parallel)
29-
00:00:00.1739174 Empty Pool (.TryTake())
30-
00:00:03.0737445 TOTAL
26+
00:00:00.6262788 Take From Empty (In Parallel)
27+
00:00:00.5193854 Give To (In Parallel)
28+
00:00:00.5256468 Mixed Read/Write (In Parallel)
29+
00:00:00.0980145 Empty Pool (.TryTake())
30+
00:00:01.7693255 TOTAL
3131

3232

3333
Repeat 80000 for size 10
3434
------------------------------------
3535

3636
QueueObjectPool.........................................
37-
00:00:00.5346130 Take From Empty (In Parallel)
38-
00:00:00.5352514 Give To (In Parallel)
39-
00:00:00.4743420 Mixed Read/Write (In Parallel)
40-
00:00:00.1366686 Empty Pool (.TryTake())
41-
00:00:01.6808750 TOTAL
37+
00:00:00.4154226 Take From Empty (In Parallel)
38+
00:00:00.3984580 Give To (In Parallel)
39+
00:00:00.3555039 Mixed Read/Write (In Parallel)
40+
00:00:00.1029956 Empty Pool (.TryTake())
41+
00:00:01.2723801 TOTAL
4242

4343
ConcurrentQueueObjectPool...............................
44-
00:00:00.5718558 Take From Empty (In Parallel)
45-
00:00:00.5354731 Give To (In Parallel)
46-
00:00:00.5125773 Mixed Read/Write (In Parallel)
47-
00:00:00.1602205 Empty Pool (.TryTake())
48-
00:00:01.7801267 TOTAL
44+
00:00:00.4010665 Take From Empty (In Parallel)
45+
00:00:00.3802531 Give To (In Parallel)
46+
00:00:00.3610812 Mixed Read/Write (In Parallel)
47+
00:00:00.0846055 Empty Pool (.TryTake())
48+
00:00:01.2270063 TOTAL
4949

5050
ConcurrentStackObjectPool...............................
51-
00:00:00.5552188 Take From Empty (In Parallel)
52-
00:00:00.5154776 Give To (In Parallel)
53-
00:00:00.4801922 Mixed Read/Write (In Parallel)
54-
00:00:00.1249209 Empty Pool (.TryTake())
55-
00:00:01.6758095 TOTAL
51+
00:00:00.4181783 Take From Empty (In Parallel)
52+
00:00:00.4003157 Give To (In Parallel)
53+
00:00:00.3933568 Mixed Read/Write (In Parallel)
54+
00:00:00.0930685 Empty Pool (.TryTake())
55+
00:00:01.3049193 TOTAL
5656

5757
OptimisticArrayObjectPool...............................
58-
00:00:00.5270367 Take From Empty (In Parallel)
59-
00:00:00.4550340 Give To (In Parallel)
60-
00:00:00.4407644 Mixed Read/Write (In Parallel)
61-
00:00:00.2186592 Empty Pool (.TryTake())
62-
00:00:01.6414943 TOTAL
58+
00:00:00.4154931 Take From Empty (In Parallel)
59+
00:00:00.3539234 Give To (In Parallel)
60+
00:00:00.3306813 Mixed Read/Write (In Parallel)
61+
00:00:00.1595689 Empty Pool (.TryTake())
62+
00:00:01.2596667 TOTAL
6363

6464

6565
Repeat 24000 for size 50
6666
------------------------------------
6767

6868
QueueObjectPool.........................................
69-
00:00:00.2622830 Take From Empty (In Parallel)
70-
00:00:00.4367957 Give To (In Parallel)
71-
00:00:00.2884833 Mixed Read/Write (In Parallel)
72-
00:00:00.1834193 Empty Pool (.TryTake())
73-
00:00:01.1709813 TOTAL
69+
00:00:00.1983285 Take From Empty (In Parallel)
70+
00:00:00.5393018 Give To (In Parallel)
71+
00:00:00.2520056 Mixed Read/Write (In Parallel)
72+
00:00:00.1437719 Empty Pool (.TryTake())
73+
00:00:01.1334078 TOTAL
7474

7575
ConcurrentQueueObjectPool...............................
76-
00:00:00.2719027 Take From Empty (In Parallel)
77-
00:00:00.2854846 Give To (In Parallel)
78-
00:00:00.2650888 Mixed Read/Write (In Parallel)
79-
00:00:00.2203011 Empty Pool (.TryTake())
80-
00:00:01.0427772 TOTAL
76+
00:00:00.1911597 Take From Empty (In Parallel)
77+
00:00:00.6099586 Give To (In Parallel)
78+
00:00:00.2019195 Mixed Read/Write (In Parallel)
79+
00:00:00.1173744 Empty Pool (.TryTake())
80+
00:00:01.1204122 TOTAL
8181

8282
ConcurrentStackObjectPool...............................
83-
00:00:00.2640431 Take From Empty (In Parallel)
84-
00:00:00.3351598 Give To (In Parallel)
85-
00:00:00.2996782 Mixed Read/Write (In Parallel)
86-
00:00:00.2149665 Empty Pool (.TryTake())
87-
00:00:01.1138476 TOTAL
83+
00:00:00.1947059 Take From Empty (In Parallel)
84+
00:00:00.2563897 Give To (In Parallel)
85+
00:00:00.2213445 Mixed Read/Write (In Parallel)
86+
00:00:00.1613517 Empty Pool (.TryTake())
87+
00:00:00.8337918 TOTAL
8888

8989
OptimisticArrayObjectPool...............................
90-
00:00:00.3047471 Take From Empty (In Parallel)
91-
00:00:00.3823836 Give To (In Parallel)
92-
00:00:00.2115898 Mixed Read/Write (In Parallel)
93-
00:00:00.8433052 Empty Pool (.TryTake())
94-
00:00:01.7420257 TOTAL
90+
00:00:00.2011463 Take From Empty (In Parallel)
91+
00:00:00.2458962 Give To (In Parallel)
92+
00:00:00.1567710 Mixed Read/Write (In Parallel)
93+
00:00:00.5725949 Empty Pool (.TryTake())
94+
00:00:01.1764084 TOTAL
9595

9696

9797
Repeat 16000 for size 100
9898
------------------------------------
9999

100100
QueueObjectPool.........................................
101-
00:00:00.2680744 Take From Empty (In Parallel)
102-
00:00:00.4845459 Give To (In Parallel)
103-
00:00:00.3117290 Mixed Read/Write (In Parallel)
104-
00:00:00.2375035 Empty Pool (.TryTake())
105-
00:00:01.3018528 TOTAL
101+
00:00:00.1917082 Take From Empty (In Parallel)
102+
00:00:00.7281393 Give To (In Parallel)
103+
00:00:00.4965600 Mixed Read/Write (In Parallel)
104+
00:00:00.1853762 Empty Pool (.TryTake())
105+
00:00:01.6017837 TOTAL
106106

107107
ConcurrentQueueObjectPool...............................
108-
00:00:00.2620082 Take From Empty (In Parallel)
109-
00:00:00.2949254 Give To (In Parallel)
110-
00:00:00.2538674 Mixed Read/Write (In Parallel)
111-
00:00:00.2908684 Empty Pool (.TryTake())
112-
00:00:01.1016694 TOTAL
108+
00:00:00.1913408 Take From Empty (In Parallel)
109+
00:00:00.5323921 Give To (In Parallel)
110+
00:00:06.1167135 Mixed Read/Write (In Parallel)
111+
00:00:00.3403016 Empty Pool (.TryTake())
112+
00:00:07.1807480 TOTAL
113113

114114
ConcurrentStackObjectPool...............................
115-
00:00:00.2735071 Take From Empty (In Parallel)
116-
00:00:00.3903024 Give To (In Parallel)
117-
00:00:00.3434028 Mixed Read/Write (In Parallel)
118-
00:00:00.3366711 Empty Pool (.TryTake())
119-
00:00:01.3438834 TOTAL
115+
00:00:00.1864700 Take From Empty (In Parallel)
116+
00:00:00.2674701 Give To (In Parallel)
117+
00:00:00.2333379 Mixed Read/Write (In Parallel)
118+
00:00:00.2567077 Empty Pool (.TryTake())
119+
00:00:00.9439857 TOTAL
120120

121121
OptimisticArrayObjectPool...............................
122-
00:00:00.7922812 Take From Empty (In Parallel)
123-
00:00:00.6641963 Give To (In Parallel)
124-
00:00:00.2030016 Mixed Read/Write (In Parallel)
125-
00:00:01.7548815 Empty Pool (.TryTake())
126-
00:00:03.4143606 TOTAL
122+
00:00:00.2117531 Take From Empty (In Parallel)
123+
00:00:00.3088107 Give To (In Parallel)
124+
00:00:00.1494503 Mixed Read/Write (In Parallel)
125+
00:00:01.2309936 Empty Pool (.TryTake())
126+
00:00:01.9010077 TOTAL
127127

128128

129129
Repeat 25600 for size 250
130130
------------------------------------
131131

132132
QueueObjectPool.........................................
133-
00:00:00.7668417 Take From Empty (In Parallel)
134-
00:00:01.8047414 Give To (In Parallel)
135-
00:00:01.3185354 Mixed Read/Write (In Parallel)
136-
00:00:00.8664007 Empty Pool (.TryTake())
137-
00:00:04.7565192 TOTAL
133+
00:00:00.4827432 Take From Empty (In Parallel)
134+
00:00:02.6029248 Give To (In Parallel)
135+
00:00:02.6176686 Mixed Read/Write (In Parallel)
136+
00:00:00.6578479 Empty Pool (.TryTake())
137+
00:00:06.3611845 TOTAL
138138

139139
ConcurrentQueueObjectPool...............................
140-
00:00:00.8378978 Take From Empty (In Parallel)
141-
00:00:00.9370109 Give To (In Parallel)
142-
00:00:00.7695238 Mixed Read/Write (In Parallel)
143-
00:00:01.0984692 Empty Pool (.TryTake())
144-
00:00:03.6429017 TOTAL
140+
00:00:00.7486876 Take From Empty (In Parallel)
141+
00:00:35.1458453 Give To (In Parallel)
142+
00:00:59.9447445 Mixed Read/Write (In Parallel)
143+
00:00:05.0064751 Empty Pool (.TryTake())
144+
00:01:40.8457525 TOTAL
145145

146146
ConcurrentStackObjectPool...............................
147-
00:00:00.7848982 Take From Empty (In Parallel)
148-
00:00:01.5942377 Give To (In Parallel)
149-
00:00:01.5995650 Mixed Read/Write (In Parallel)
150-
00:00:01.7959374 Empty Pool (.TryTake())
151-
00:00:05.7746383 TOTAL
147+
00:00:00.5360153 Take From Empty (In Parallel)
148+
00:00:01.0427376 Give To (In Parallel)
149+
00:00:00.9601208 Mixed Read/Write (In Parallel)
150+
00:00:01.4689654 Empty Pool (.TryTake())
151+
00:00:04.0078391 TOTAL
152152

153153
OptimisticArrayObjectPool...............................
154-
00:00:01.2561773 Take From Empty (In Parallel)
155-
00:00:03.2871367 Give To (In Parallel)
156-
00:00:00.5424299 Mixed Read/Write (In Parallel)
157-
00:00:12.0158755 Empty Pool (.TryTake())
158-
00:00:17.1016194 TOTAL
154+
00:00:00.9522035 Take From Empty (In Parallel)
155+
00:00:02.1958969 Give To (In Parallel)
156+
00:00:00.4701271 Mixed Read/Write (In Parallel)
157+
00:00:10.4725119 Empty Pool (.TryTake())
158+
00:00:14.0907394 TOTAL
159159

160160

benchmarking/Open.Disposable.ObjectPools.Benchmarking.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>netstandard2.0</TargetFramework>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
66
<RootNamespace>Open.Disposable</RootNamespace>
77
<Version>1.0.0</Version>
88
</PropertyGroup>

source/Collection/ConcurrentQueueObjectPool.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ protected override T TryRelease()
5252

5353
protected override void OnDispose(bool calledExplicitly)
5454
{
55-
Pool = null;
55+
if(calledExplicitly)
56+
{
57+
Pool = null;
58+
}
5659
}
5760

5861
}

source/Open.Disposable.ObjectPools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Part of the "Open" set of libraries.</Description>
2828

2929
<ItemGroup>
3030
<PackageReference Include="Open.Disposable" Version="1.1.0" />
31-
<PackageReference Include="Open.Threading.Tasks" Version="1.1.0" />
31+
<PackageReference Include="Open.Threading.Tasks" Version="1.1.2" />
3232
</ItemGroup>
3333

3434
</Project>

0 commit comments

Comments
 (0)