@daneren2005/shared-memory-objects 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -25
- package/dist/shared-memory-objects.js +452 -274
- package/dist/shared-memory-objects.js.map +1 -1
- package/dist/shared-memory-objects.umd.cjs +1 -1
- package/dist/shared-memory-objects.umd.cjs.map +1 -1
- package/dist/src/main.d.ts +3 -1
- package/dist/src/shared-pool.d.ts +1 -0
- package/dist/src/utils/atomic-math.d.ts +4 -0
- package/dist/src/utils/float32-atomics.d.ts +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,9 +76,9 @@ let secondList = new SharedList(memory, mainList.getSharedMemory());
|
|
|
76
76
|
The tl;dr is that none of these data structures are close to what you can get by just using native data structures, but I wasn't expecting them to be with their overhead.
|
|
77
77
|
They are all significantly slower at iterating and accessing an indexed location. The SharedList is slowest at everything.
|
|
78
78
|
The SharedPool is the closest to native performance when doing a bunch of random deletes and inserts, which is what I use it for as the memory storage for components in my own ECS framework.
|
|
79
|
-
Since indexed access is about 1/
|
|
79
|
+
Since indexed access is about 1/4 the speed of just using a native JS array, there needs to be a lot of work offloaded into a separate thread to make it worth it.
|
|
80
80
|
|
|
81
|
-
Shared Data Structures: 10000 iterations
|
|
81
|
+
Shared Data Structures: 10000 iterations
|
|
82
82
|
```
|
|
83
83
|
name hz min max mean p75 p99 p995 p999 rme samples
|
|
84
84
|
shared list 1,178.27 0.7080 1.8484 0.8487 0.9095 1.4762 1.5502 1.8484 ±1.38% 590
|
|
@@ -92,19 +92,19 @@ native array
|
|
|
92
92
|
333.33x faster than shared list
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
Shared Data Structures: 1000 indexed locations
|
|
95
|
+
Shared Data Structures: 1000 indexed locations
|
|
96
96
|
```
|
|
97
97
|
name hz min max mean p75 p99 p995 p999 rme samples
|
|
98
|
-
shared vector
|
|
99
|
-
shared pool
|
|
100
|
-
native array
|
|
98
|
+
shared vector 27,325.20 0.0313 0.3615 0.0366 0.0333 0.0689 0.0859 0.2216 ±0.60% 13663
|
|
99
|
+
shared pool 31,568.26 0.0272 0.2785 0.0317 0.0295 0.0583 0.0692 0.1803 ±0.50% 15785
|
|
100
|
+
native array 114,517.08 0.0074 0.2652 0.0087 0.0079 0.0171 0.0254 0.1205 ±0.56% 57259
|
|
101
101
|
|
|
102
102
|
native array
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
3.63x faster than shared pool
|
|
104
|
+
4.19x faster than shared vector
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
Shared Data Structures: 1000 inserts
|
|
107
|
+
Shared Data Structures: 1000 inserts
|
|
108
108
|
```
|
|
109
109
|
name hz min max mean p75 p99 p995 p999 rme samples
|
|
110
110
|
shared list 2,154.19 0.4107 1.1497 0.4642 0.4531 0.8892 0.9123 1.0928 ±1.14% 1078
|
|
@@ -122,32 +122,32 @@ native array
|
|
|
122
122
|
914.45x faster than shared map
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
Shared Data Structures: 1000 deletes random element
|
|
125
|
+
Shared Data Structures: 1000 deletes random element
|
|
126
126
|
```
|
|
127
127
|
name hz min max mean p75 p99 p995 p999 rme samples
|
|
128
|
-
shared list
|
|
129
|
-
shared vector
|
|
130
|
-
shared pool
|
|
131
|
-
native array
|
|
128
|
+
shared list 14.1243 60.2658 82.0964 70.7998 77.6842 82.0964 82.0964 82.0964 ±6.93% 10
|
|
129
|
+
shared vector 393.31 2.3719 3.4563 2.5425 2.5639 3.3824 3.4563 3.4563 ±0.81% 197
|
|
130
|
+
shared pool 8,824.76 0.1005 0.4998 0.1133 0.1085 0.2338 0.2631 0.3420 ±0.72% 4413
|
|
131
|
+
native array 10,750.49 0.0829 0.6180 0.0930 0.0908 0.1494 0.1592 0.2420 ±0.45% 5376
|
|
132
132
|
|
|
133
133
|
native array
|
|
134
|
-
1.
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
1.22x faster than shared pool
|
|
135
|
+
27.33x faster than shared vector
|
|
136
|
+
761.13x faster than shared list
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
Shared Data Structures: 1000 insert and deleting random elements
|
|
139
|
+
Shared Data Structures: 1000 insert and deleting random elements
|
|
140
140
|
```
|
|
141
141
|
name hz min max mean p75 p99 p995 p999 rme samples
|
|
142
|
-
shared list 23.
|
|
143
|
-
shared vector
|
|
144
|
-
shared pool 4,
|
|
145
|
-
native array
|
|
142
|
+
shared list 23.3898 40.4675 46.8902 42.7537 43.4073 46.8902 46.8902 46.8902 ±3.04% 12
|
|
143
|
+
shared vector 848.84 1.0093 2.1141 1.1781 1.1890 1.9349 1.9559 2.1141 ±1.42% 425
|
|
144
|
+
shared pool 4,862.78 0.1822 0.6673 0.2056 0.1974 0.3683 0.3796 0.4319 ±0.75% 2432
|
|
145
|
+
native array 10,584.21 0.0808 0.3616 0.0945 0.0897 0.2304 0.2540 0.3033 ±0.71% 5293
|
|
146
146
|
|
|
147
147
|
native array
|
|
148
|
-
2.
|
|
149
|
-
12.
|
|
150
|
-
|
|
148
|
+
2.18x faster than shared pool
|
|
149
|
+
12.47x faster than shared vector
|
|
150
|
+
452.51x faster than shared list
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
## Credit
|