Skip to content

Benchmarks

emmanueltouzery edited this page Aug 16, 2018 · 5 revisions
> prelude.ts@0.7.8 benchmarks /home/emmanuel/home/prelude.ts
> tsc && node ./dist/benchmarks/bench.js

immList, immSet are the immutablejs list,set... https://facebook.github.io/immutable-js/
funkiaList is the list from https://github.com/funkia/list
node version: v8.11.3

n = 200
Vector.toArray x 939,675 ops/sec ±0.62% (94 runs sampled)
LinkedList.toArray x 1,025,280 ops/sec ±0.82% (88 runs sampled)
immList.toArray x 189,773 ops/sec ±0.64% (92 runs sampled)
funkiaList.toArray x 1,024,310 ops/sec ±0.76% (92 runs sampled)
Fastest is LinkedList.toArray,funkiaList.toArray

n = 10000
Vector.toArray x 19,238 ops/sec ±0.59% (90 runs sampled)
LinkedList.toArray x 18,083 ops/sec ±0.36% (95 runs sampled)
immList.toArray x 3,098 ops/sec ±0.77% (96 runs sampled)
funkiaList.toArray x 19,410 ops/sec ±0.22% (98 runs sampled)
Fastest is funkiaList.toArray

n = 200
Vector.take x 2,850,671 ops/sec ±1.08% (95 runs sampled)
Array.slice x 1,685,465 ops/sec ±0.23% (96 runs sampled)
immList.take x 1,055,375 ops/sec ±0.78% (92 runs sampled)
LinkedList.take x 234,042 ops/sec ±0.19% (57 runs sampled)
funkiaList.take x 2,899,348 ops/sec ±0.60% (96 runs sampled)
Fastest is funkiaList.take

n = 10000
Vector.take x 2,022,344 ops/sec ±0.98% (95 runs sampled)
Array.slice x 56,479 ops/sec ±0.56% (94 runs sampled)
immList.take x 706,764 ops/sec ±0.82% (95 runs sampled)
LinkedList.take x 4,262 ops/sec ±0.61% (91 runs sampled)
funkiaList.take x 2,067,802 ops/sec ±0.94% (92 runs sampled)
Fastest is funkiaList.take

n = 200
Vector.drop x 2,649,183 ops/sec ±0.26% (96 runs sampled)
Array.slice x 3,280,342 ops/sec ±0.69% (94 runs sampled)
immList.slice x 2,174,445 ops/sec ±0.21% (96 runs sampled)
LinkedList.drop x 3,388,910 ops/sec ±0.66% (95 runs sampled)
funkiaList.drop x 2,663,509 ops/sec ±0.24% (95 runs sampled)
Fastest is LinkedList.drop

n = 10000
Vector.drop x 1,714,230 ops/sec ±1.15% (91 runs sampled)
Array.slice x 166,897 ops/sec ±0.14% (97 runs sampled)
immList.slice x 1,448,203 ops/sec ±1.02% (95 runs sampled)
LinkedList.drop x 55,091 ops/sec ±0.11% (96 runs sampled)
funkiaList.drop x 1,741,259 ops/sec ±1.56% (94 runs sampled)
Fastest is funkiaList.drop

n = 200
Vector.filter x 218,153 ops/sec ±0.24% (94 runs sampled)
Array.filter x 254,651 ops/sec ±0.16% (92 runs sampled)
immList.filter x 31,355 ops/sec ±4.02% (72 runs sampled)
LinkedList.filter x 176,137 ops/sec ±0.58% (96 runs sampled)
funkiaList.filter x 134,535 ops/sec ±2.36% (84 runs sampled)
Fastest is Array.filter

n = 10000
Vector.filter x 3,713 ops/sec ±0.15% (96 runs sampled)
Array.filter x 4,823 ops/sec ±0.31% (96 runs sampled)
immList.filter x 889 ops/sec ±0.95% (94 runs sampled)
LinkedList.filter x 5,261 ops/sec ±1.40% (93 runs sampled)
funkiaList.filter x 3,655 ops/sec ±0.20% (95 runs sampled)
Fastest is LinkedList.filter

n = 200
Vector.map x 606,392 ops/sec ±0.23% (93 runs sampled)
Array.map x 371,954 ops/sec ±0.83% (95 runs sampled)
immList.map x 37,968 ops/sec ±3.62% (78 runs sampled)
LinkedList.map x 113,709 ops/sec ±0.60% (73 runs sampled)
funkiaList.map x 492,548 ops/sec ±0.77% (89 runs sampled)
Fastest is Vector.map

n = 10000
Vector.map x 11,305 ops/sec ±0.35% (95 runs sampled)
Array.map x 7,880 ops/sec ±0.78% (96 runs sampled)
immList.map x 764 ops/sec ±0.74% (93 runs sampled)
LinkedList.map x 3,212 ops/sec ±0.25% (95 runs sampled)
funkiaList.map x 11,292 ops/sec ±0.79% (95 runs sampled)
Fastest is Vector.map,funkiaList.map

n = 200
Vector.find x 616,103 ops/sec ±0.38% (97 runs sampled)
Array.find x 459,415 ops/sec ±0.66% (95 runs sampled)
immList.find x 150,366 ops/sec ±0.39% (92 runs sampled)
LinkedList.find x 2,422,569 ops/sec ±0.68% (94 runs sampled)
funkiaList.find x 612,467 ops/sec ±0.57% (96 runs sampled)
Fastest is LinkedList.find

n = 10000
Vector.find x 13,249 ops/sec ±0.22% (98 runs sampled)
Array.find x 9,530 ops/sec ±0.69% (96 runs sampled)
immList.find x 2,561 ops/sec ±0.79% (95 runs sampled)
LinkedList.find x 39,640 ops/sec ±0.37% (95 runs sampled)
funkiaList.find x 13,110 ops/sec ±0.12% (97 runs sampled)
Fastest is LinkedList.find

n = 200
Vector.ofIterable x 250,782 ops/sec ±0.91% (96 runs sampled)
rawhamt.build from iterable x 31,237 ops/sec ±0.39% (93 runs sampled)
rawhamt.build from array x 32,097 ops/sec ±1.18% (91 runs sampled)
rawhamtBase.build from iterable x 26,503 ops/sec ±0.37% (93 runs sampled)
LinkedList.ofIterable x 152,665 ops/sec ±1.55% (64 runs sampled)
immList.ofIterable x 82,012 ops/sec ±0.53% (92 runs sampled)
funkiaList.ofArray x 302,818 ops/sec ±0.74% (96 runs sampled)
Fastest is funkiaList.ofArray

n = 10000
Vector.ofIterable x 4,166 ops/sec ±0.74% (93 runs sampled)
rawhamt.build from iterable x 510 ops/sec ±1.20% (72 runs sampled)
rawhamt.build from array x 545 ops/sec ±0.62% (87 runs sampled)
rawhamtBase.build from iterable x 306 ops/sec ±0.33% (90 runs sampled)
LinkedList.ofIterable x 2,855 ops/sec ±1.29% (93 runs sampled)
immList.ofIterable x 1,200 ops/sec ±0.71% (94 runs sampled)
funkiaList.ofArray x 4,511 ops/sec ±2.06% (85 runs sampled)
Fastest is funkiaList.ofArray

n = 200
Vector.get(i) x 29,525,164 ops/sec ±0.36% (94 runs sampled)
rawhamt.get(i) x 26,454,434 ops/sec ±0.68% (90 runs sampled)
rawhamtBase.get(i) x 29,362,854 ops/sec ±0.43% (93 runs sampled)
LinkedList.get(i) x 4,525,618 ops/sec ±0.66% (97 runs sampled)
Array.get(i) x 80,334,644 ops/sec ±0.40% (88 runs sampled)
immList.get(i) x 38,143,694 ops/sec ±0.57% (95 runs sampled)
funkiaList.get(i) x 43,534,164 ops/sec ±0.41% (88 runs sampled)
Fastest is Array.get(i)

n = 10000
Vector.get(i) x 27,347,229 ops/sec ±0.78% (89 runs sampled)
rawhamt.get(i) x 21,613,032 ops/sec ±0.51% (94 runs sampled)
rawhamtBase.get(i) x 22,927,060 ops/sec ±0.84% (96 runs sampled)
LinkedList.get(i) x 81,759 ops/sec ±0.16% (94 runs sampled)
Array.get(i) x 76,628,960 ops/sec ±0.91% (84 runs sampled)
immList.get(i) x 28,169,792 ops/sec ±0.32% (92 runs sampled)
funkiaList.get(i) x 34,230,427 ops/sec ±0.72% (92 runs sampled)
Fastest is Array.get(i)

n = 200
Vector.flatMap x 16,813 ops/sec ±0.54% (92 runs sampled)
LinkedList.flatMap x 7,726 ops/sec ±2.13% (86 runs sampled)
immList.flatMap x 3,743 ops/sec ±1.76% (87 runs sampled)
funkiaList.chain x 11,844 ops/sec ±0.67% (96 runs sampled)
Fastest is Vector.flatMap

n = 10000
Vector.flatMap x 224 ops/sec ±3.68% (84 runs sampled)
LinkedList.flatMap x 127 ops/sec ±0.69% (80 runs sampled)
immList.flatMap x 88.37 ops/sec ±1.08% (75 runs sampled)
funkiaList.chain x 240 ops/sec ±0.94% (80 runs sampled)
Fastest is funkiaList.chain,Vector.flatMap

n = 200
Vector.reverse x 176,357 ops/sec ±1.17% (86 runs sampled)
Array.reverse x 721,028 ops/sec ±0.20% (93 runs sampled)
immList.reverse x 40,943 ops/sec ±3.03% (80 runs sampled)
LinkedList.reverse x 728,524 ops/sec ±8.97% (95 runs sampled)
funkiaList.reverse x 145,779 ops/sec ±0.92% (92 runs sampled)
Fastest is Array.reverse

n = 10000
Vector.reverse x 3,066 ops/sec ±1.03% (95 runs sampled)
Array.reverse x 16,048 ops/sec ±0.35% (97 runs sampled)
immList.reverse x 806 ops/sec ±0.81% (93 runs sampled)
LinkedList.reverse x 13,420 ops/sec ±0.30% (92 runs sampled)
funkiaList.reverse x 3,071 ops/sec ±0.87% (94 runs sampled)
Fastest is Array.reverse

n = 200
Vector.groupBy x 11,005 ops/sec ±2.23% (89 runs sampled)
LinkedList.groupBy x 9,545 ops/sec ±2.83% (90 runs sampled)
immList.groupBy x 12,514 ops/sec ±2.73% (87 runs sampled)
Fastest is immList.groupBy

n = 10000
Vector.groupBy x 193 ops/sec ±0.60% (81 runs sampled)
LinkedList.groupBy x 179 ops/sec ±0.24% (82 runs sampled)
immList.groupBy x 273 ops/sec ±2.15% (81 runs sampled)
Fastest is immList.groupBy

n = 200
Vector.append x 210,102 ops/sec ±1.33% (91 runs sampled)
Array.push x 1,041,982 ops/sec ±1.30% (92 runs sampled)
immList.push x 13,426 ops/sec ±0.79% (95 runs sampled)
LinkedList.append x 3,300 ops/sec ±0.27% (95 runs sampled)
Funkia.append x 286,515 ops/sec ±0.71% (93 runs sampled)
Fastest is Array.push

n = 10000
Vector.append x 3,730 ops/sec ±0.23% (89 runs sampled)
Array.push x 19,258 ops/sec ±0.50% (95 runs sampled)
immList.push x 263 ops/sec ±0.53% (87 runs sampled)
LinkedList.append: 
Funkia.append x 4,750 ops/sec ±0.66% (94 runs sampled)
Fastest is Array.push

n = 200
Vector.prepend x 187,389 ops/sec ±0.84% (94 runs sampled)
Array.unshift x 92,411 ops/sec ±0.35% (95 runs sampled)
immList.unshift x 6,538 ops/sec ±1.36% (95 runs sampled)
LinkedList.prepend x 682,966 ops/sec ±0.79% (95 runs sampled)
Funkia.prepend x 229,481 ops/sec ±0.17% (91 runs sampled)
Fastest is LinkedList.prepend

n = 10000
Vector.prepend x 3,190 ops/sec ±1.29% (89 runs sampled)
Array.unshift x 88.56 ops/sec ±0.32% (75 runs sampled)
immList.unshift x 97.39 ops/sec ±0.16% (82 runs sampled)
LinkedList.prepend x 12,638 ops/sec ±1.17% (94 runs sampled)
Funkia.prepend x 3,925 ops/sec ±0.20% (90 runs sampled)
Fastest is LinkedList.prepend

n = 200
Vector.iterate x 601,649 ops/sec ±0.80% (95 runs sampled)
Array.iterate x 423,365 ops/sec ±0.23% (95 runs sampled)
immList.iterate x 122,574 ops/sec ±1.04% (94 runs sampled)
LinkedList.iterate x 337,447 ops/sec ±0.76% (95 runs sampled)
Funkia.iterate x 347,033 ops/sec ±0.86% (95 runs sampled)
Fastest is Vector.iterate

n = 10000
Vector.iterate x 11,230 ops/sec ±0.27% (92 runs sampled)
Array.iterate x 8,721 ops/sec ±0.73% (95 runs sampled)
immList.iterate x 2,217 ops/sec ±0.70% (95 runs sampled)
LinkedList.iterate x 7,229 ops/sec ±1.11% (97 runs sampled)
Funkia.iterate x 6,757 ops/sec ±0.37% (96 runs sampled)
Fastest is Vector.iterate

n = 200
Vector.appendAll x 1,105,465 ops/sec ±1.08% (96 runs sampled)
Array.appendAll x 1,237,198 ops/sec ±0.44% (93 runs sampled)
immList.appendAll x 23,074 ops/sec ±1.77% (76 runs sampled)
LinkedList.appendAll x 56,805 ops/sec ±1.11% (94 runs sampled)
Funkia.concat x 1,212,969 ops/sec ±1.18% (93 runs sampled)
Fastest is Array.appendAll

n = 10000
Vector.appendAll x 320,391 ops/sec ±0.23% (96 runs sampled)
Array.appendAll x 33,461 ops/sec ±0.29% (93 runs sampled)
immList.appendAll x 575 ops/sec ±0.85% (93 runs sampled)
LinkedList.appendAll x 1,007 ops/sec ±0.44% (78 runs sampled)
Funkia.concat x 323,644 ops/sec ±1.01% (93 runs sampled)
Fastest is Funkia.concat

n = 200
Vector.prependAll x 170,977 ops/sec ±0.45% (94 runs sampled)
Array.prependAll x 1,237,433 ops/sec ±0.63% (96 runs sampled)
LinkedList.prependAll x 83,551 ops/sec ±0.69% (90 runs sampled)
Fastest is Array.prependAll

n = 10000
Vector.prependAll x 3,570 ops/sec ±1.15% (95 runs sampled)
Array.prependAll x 33,513 ops/sec ±0.46% (93 runs sampled)
LinkedList.prependAll x 1,549 ops/sec ±1.56% (92 runs sampled)
Fastest is Array.prependAll

n = 200
Vector.foldLeft x 776,875 ops/sec ±0.36% (93 runs sampled)
Array.foldLeft x 431,939 ops/sec ±0.69% (96 runs sampled)
immList.foldLeft x 152,169 ops/sec ±0.38% (93 runs sampled)
LinkedList.foldLeft x 774,333 ops/sec ±0.45% (96 runs sampled)
Funkia.foldl x 773,983 ops/sec ±0.55% (95 runs sampled)
Fastest is Vector.foldLeft,LinkedList.foldLeft,Funkia.foldl

n = 10000
Vector.foldLeft x 13,893 ops/sec ±0.38% (96 runs sampled)
Array.foldLeft x 9,318 ops/sec ±0.14% (98 runs sampled)
immList.foldLeft x 2,566 ops/sec ±0.46% (95 runs sampled)
LinkedList.foldLeft x 14,008 ops/sec ±0.17% (97 runs sampled)
Funkia.foldl x 13,995 ops/sec ±0.26% (95 runs sampled)
Fastest is LinkedList.foldLeft,Funkia.foldl,Vector.foldLeft

n = 200
Vector.foldRight x 836,220 ops/sec ±0.96% (92 runs sampled)
immList.foldRight x 149,835 ops/sec ±0.35% (94 runs sampled)
LinkedList.foldRight x 839,847 ops/sec ±0.47% (97 runs sampled)
Funkia.foldr x 846,901 ops/sec ±0.52% (95 runs sampled)
Fastest is Funkia.foldr

n = 10000
Vector.foldRight x 15,116 ops/sec ±0.44% (97 runs sampled)
immList.foldRight x 2,561 ops/sec ±0.73% (96 runs sampled)
LinkedList.foldRight x 15,165 ops/sec ±0.34% (96 runs sampled)
Funkia.foldr x 15,224 ops/sec ±0.09% (98 runs sampled)
Fastest is Funkia.foldr,Vector.foldRight

n = 200
HashSet.ofIterable x 2,520 ops/sec ±4.65% (52 runs sampled)
immSet x 13,959 ops/sec ±1.39% (88 runs sampled)
Fastest is immSet

n = 10000
HashSet.ofIterable x 127 ops/sec ±3.19% (65 runs sampled)
immSet x 357 ops/sec ±1.76% (75 runs sampled)
Fastest is immSet

n = 200
HashSet.ofIterable (from vector) x 2,382 ops/sec ±3.83% (35 runs sampled)
immSet (from vector) x 11,584 ops/sec ±3.45% (84 runs sampled)
Fastest is immSet (from vector)

n = 10000
HashSet.ofIterable (from vector) x 120 ops/sec ±3.24% (69 runs sampled)
immSet (from vector) x 328 ops/sec ±1.40% (87 runs sampled)
Fastest is immSet (from vector)

n = 200
HashSet.contains x 10,273,512 ops/sec ±0.37% (96 runs sampled)
immSet.contains x 11,983,671 ops/sec ±0.78% (91 runs sampled)
Fastest is immSet.contains

n = 10000
HashSet.contains x 7,505,345 ops/sec ±0.27% (97 runs sampled)
immSet.contains x 6,547,452 ops/sec ±0.84% (89 runs sampled)
Fastest is HashSet.contains

n = 200
HashSet.filter x 12,994 ops/sec ±5.01% (84 runs sampled)
immSet.filter x 14,023 ops/sec ±4.29% (71 runs sampled)
Fastest is immSet.filter

n = 10000
HashSet.filter x 399 ops/sec ±1.00% (84 runs sampled)
immSet.filter x 714 ops/sec ±3.51% (88 runs sampled)
Fastest is immSet.filter

n = 200
HashMap.ofIterable x 4,038 ops/sec ±4.16% (66 runs sampled)
immMap x 24,057 ops/sec ±0.34% (94 runs sampled)
Fastest is immMap

n = 10000
HashMap.ofIterable x 178 ops/sec ±1.58% (70 runs sampled)
immMap x 328 ops/sec ±0.36% (86 runs sampled)
Fastest is immMap

n = 200
HashMap.ofIterable (from vector) x 3,857 ops/sec ±4.32% (72 runs sampled)
immMap (from vector) x 22,091 ops/sec ±0.21% (93 runs sampled)
Fastest is immMap (from vector)

n = 10000
HashMap.ofIterable (from vector) x 178 ops/sec ±2.11% (82 runs sampled)
immMap (from vector) x 313 ops/sec ±1.00% (86 runs sampled)
Fastest is immMap (from vector)

n = 200
HashMap.get x 8,253,023 ops/sec ±0.43% (95 runs sampled)
immMap.get x 7,684,024 ops/sec ±0.70% (90 runs sampled)
Fastest is HashMap.get

n = 10000
HashMap.get x 3,686,207 ops/sec ±1.44% (90 runs sampled)
immMap.get x 3,802,331 ops/sec ±0.49% (93 runs sampled)
Fastest is immMap.get

n = 200
HashMap.filter x 10,602 ops/sec ±7.66% (83 runs sampled)
immMap.filter x 25,768 ops/sec ±4.21% (65 runs sampled)
Fastest is immMap.filter

n = 10000
HashMap.filter x 280 ops/sec ±2.05% (85 runs sampled)
immMap.filter x 714 ops/sec ±0.52% (93 runs sampled)
Fastest is immMap.filter
Clone this wiki locally