npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fleti

v0.1.1

Published

An attempt at making chained filter/map/reduce faster through let i for loops

Downloads

2

Readme

Introduction

This repository had two goals:

  • Check the speed difference in all major browsers of ]for let i, for ... of, filter/forEach/map/reduce using playwright
  • Check if it would be faster to use the same system of callbacks from filter/forEach/map/reduce/ but while using a wrapper around for let i

Benchmark

Dataset: [Math.random() * 100; 10_000_000]

Tries: 10

To avoid as much engine optimization as possible a new dataset is created before each function run (aka try).

All values that you'll find below are in milliseconds

Summary

--

Details

Filter

(x) => x > 50

for let i

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 86 | 88 | 71 | | 2 | 93 | 120 | 56 | | 3 | 74 | 87 | 54 | | 4 | 74 | 115 | 54 | | 5 | 71 | 81 | 55 | | 6 | 75 | 118 | 54 | | 7 | 91 | 84 | 55 | | 8 | 74 | 103 | 55 | | 9 | 71 | 81 | 55 | | 10 | 78 | 117 | 54 | | Average | 79 | 99 | 56 |

for of

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 164 | 133 | 62 | | 2 | 170 | 152 | 60 | | 3 | 107 | 130 | 74 | | 4 | 99 | 165 | 73 | | 5 | 104 | 130 | 74 | | 6 | 106 | 147 | 73 | | 7 | 99 | 137 | 74 | | 8 | 102 | 159 | 73 | | 9 | 105 | 126 | 73 | | 10 | 100 | 145 | 74 | | Average | 116 | 142 | 71 |

chained

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 180 | 84 | 63 | | 2 | 167 | 168 | 63 | | 3 | 163 | 132 | 62 | | 4 | 166 | 155 | 62 | | 5 | 167 | 132 | 61 | | 6 | 163 | 169 | 62 | | 7 | 166 | 132 | 62 | | 8 | 168 | 158 | 61 | | 9 | 164 | 134 | 62 | | 10 | 165 | 168 | 62 | | Average | 167 | 143 | 62 |

fleti

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 99 | 82 | 60 | | 2 | 96 | 200 | 81 | | 3 | 107 | 180 | 76 | | 4 | 103 | 181 | 66 | | 5 | 164 | 180 | 66 | | 6 | 103 | 181 | 66 | | 7 | 106 | 181 | 66 | | 8 | 104 | 182 | 66 | | 9 | 104 | 180 | 66 | | 10 | 104 | 181 | 66 | | Average | 109 | 173 | 68 |

Map

(x) => x ** 3

for let i

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 435 | 49 | 43 | | 2 | 438 | 48 | 44 | | 3 | 438 | 48 | 39 | | 4 | 436 | 48 | 36 | | 5 | 437 | 48 | 37 | | 6 | 437 | 47 | 36 | | 7 | 437 | 47 | 36 | | 8 | 438 | 47 | 36 | | 9 | 436 | 49 | 35 | | 10 | 439 | 49 | 35 | | Average | 437 | 48 | 38 |

for of

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 612 | 77 | 46 | | 2 | 615 | 80 | 46 | | 3 | 452 | 78 | 45 | | 4 | 452 | 79 | 45 | | 5 | 448 | 77 | 45 | | 6 | 453 | 79 | 45 | | 7 | 452 | 76 | 45 | | 8 | 451 | 78 | 45 | | 9 | 453 | 76 | 45 | | 10 | 450 | 78 | 45 | | Average | 484 | 78 | 45 |

chained

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 902 | 83 | 68 | | 2 | 951 | 82 | 60 | | 3 | 968 | 81 | 62 | | 4 | 1058 | 82 | 63 | | 5 | 904 | 82 | 63 | | 6 | 923 | 82 | 62 | | 7 | 921 | 82 | 62 | | 8 | 922 | 82 | 63 | | 9 | 922 | 83 | 62 | | 10 | 921 | 82 | 62 | | Average | 939 | 82 | 63 |

fleti

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 682 | 113 | 57 | | 2 | 689 | 116 | 52 | | 3 | 691 | 112 | 49 | | 4 | 690 | 117 | 49 | | 5 | 691 | 112 | 49 | | 6 | 689 | 117 | 49 | | 7 | 692 | 112 | 48 | | 8 | 688 | 118 | 49 | | 9 | 686 | 112 | 49 | | 10 | 691 | 117 | 48 | | Average | 689 | 115 | 50 |

For each

(x) => x + 1

for let i

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 9 | 18 | 8 | | 2 | 9 | 17 | 7 | | 3 | 6 | 16 | 7 | | 4 | 6 | 16 | 6 | | 5 | 6 | 17 | 6 | | 6 | 6 | 16 | 7 | | 7 | 6 | 16 | 7 | | 8 | 6 | 17 | 7 | | 9 | 6 | 16 | 7 | | 10 | 6 | 16 | 7 | | Average | 6 | 17 | 7 |

for of

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 232 | 172 | 120 | | 2 | 223 | 99 | 102 | | 3 | 235 | 168 | 102 | | 4 | 233 | 100 | 101 | | 5 | 171 | 167 | 103 | | 6 | 170 | 100 | 101 | | 7 | 173 | 165 | 106 | | 8 | 171 | 98 | 101 | | 9 | 175 | 165 | 114 | | 10 | 170 | 99 | 100 | | Average | 195 | 133 | 105 |

chained

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 93 | 54 | 26 | | 2 | 95 | 53 | 29 | | 3 | 95 | 54 | 25 | | 4 | 94 | 55 | 23 | | 5 | 93 | 53 | 23 | | 6 | 93 | 53 | 22 | | 7 | 98 | 53 | 23 | | 8 | 99 | 53 | 22 | | 9 | 95 | 52 | 23 | | 10 | 95 | 52 | 23 | | Average | 95 | 53 | 24 |

fleti

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 182 | 184 | 36 | | 2 | 183 | 127 | 47 | | 3 | 191 | 160 | 43 | | 4 | 184 | 134 | 40 | | 5 | 191 | 190 | 41 | | 6 | 183 | 135 | 40 | | 7 | 192 | 189 | 40 | | 8 | 186 | 127 | 41 | | 9 | 188 | 188 | 41 | | 10 | 184 | 127 | 40 | | Average | 186 | 156 | 41 |

Filter > Map

(x) => x > 50 => x ** 3

for let i

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 250 | 134 | 71 | | 2 | 252 | 81 | 70 | | 3 | 242 | 134 | 67 | | 4 | 240 | 81 | 65 | | 5 | 240 | 134 | 66 | | 6 | 242 | 80 | 65 | | 7 | 239 | 135 | 66 | | 8 | 241 | 81 | 65 | | 9 | 242 | 80 | 66 | | 10 | 240 | 82 | 66 | | Average | 243 | 102 | 67 |

for of

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 405 | 134 | 181 | | 2 | 408 | 131 | 129 | | 3 | 268 | 132 | 283 | | 4 | 264 | 130 | 116 | | 5 | 269 | 131 | 317 | | 6 | 267 | 125 | 317 | | 7 | 266 | 127 | 318 | | 8 | 269 | 126 | 212 | | 9 | 268 | 127 | 121 | | 10 | 266 | 126 | 116 | | Average | 295 | 129 | 211 |

chained

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 608 | 174 | 97 | | 2 | 611 | 174 | 97 | | 3 | 615 | 174 | 96 | | 4 | 616 | 173 | 98 | | 5 | 611 | 175 | 101 | | 6 | 609 | 173 | 101 | | 7 | 615 | 174 | 101 | | 8 | 612 | 174 | 100 | | 9 | 608 | 173 | 101 | | 10 | 614 | 174 | 101 | | Average | 612 | 174 | 99 |

fleti

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 420 | 180 | 78 | | 2 | 458 | 209 | 103 | | 3 | 456 | 206 | 110 | | 4 | 462 | 206 | 92 | | 5 | 457 | 207 | 91 | | 6 | 461 | 208 | 91 | | 7 | 459 | 207 | 94 | | 8 | 447 | 207 | 91 | | 9 | 458 | 207 | 91 | | 10 | 462 | 207 | 92 | | Average | 454 | 204 | 93 |

(x) => x > 50 => x ** Math.random()

for let i

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 318 | 143 | 101 | | 2 | 336 | 141 | 100 | | 3 | 302 | 141 | 98 | | 4 | 304 | 142 | 98 | | 5 | 304 | 142 | 100 | | 6 | 307 | 141 | 98 | | 7 | 301 | 141 | 98 | | 8 | 305 | 142 | 98 | | 9 | 304 | 142 | 98 | | 10 | 305 | 142 | 98 | | Average | 309 | 142 | 99 |

for of

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 444 | 193 | 240 | | 2 | 451 | 190 | 185 | | 3 | 340 | 193 | 341 | | 4 | 340 | 191 | 181 | | 5 | 337 | 193 | 369 | | 6 | 339 | 191 | 370 | | 7 | 340 | 191 | 377 | | 8 | 340 | 190 | 272 | | 9 | 341 | 190 | 171 | | 10 | 341 | 189 | 172 | | Average | 361 | 191 | 268 |

chained

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 641 | 238 | 145 | | 2 | 645 | 237 | 147 | | 3 | 648 | 238 | 139 | | 4 | 646 | 238 | 139 | | 5 | 643 | 248 | 141 | | 6 | 649 | 267 | 139 | | 7 | 647 | 237 | 138 | | 8 | 643 | 239 | 139 | | 9 | 648 | 236 | 141 | | 10 | 648 | 237 | 142 | | Average | 646 | 242 | 141 |

fleti

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 695 | 272 | 209 | | 2 | 699 | 271 | 202 | | 3 | 702 | 273 | 178 | | 4 | 699 | 272 | 181 | | 5 | 695 | 272 | 183 | | 6 | 694 | 271 | 184 | | 7 | 697 | 271 | 179 | | 8 | 694 | 272 | 177 | | 9 | 694 | 272 | 180 | | 10 | 699 | 272 | 178 | | Average | 697 | 272 | 185 |

Map > Filter > Map

(x) => round(x) => x > 50 => x * 3

for let i

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 289 | 90 | 131 | | 2 | 297 | 90 | 129 | | 3 | 282 | 90 | 124 | | 4 | 281 | 89 | 124 | | 5 | 280 | 90 | 122 | | 6 | 313 | 89 | 122 | | 7 | 284 | 89 | 123 | | 8 | 284 | 90 | 122 | | 9 | 284 | 97 | 126 | | 10 | 282 | 88 | 127 | | Average | 288 | 90 | 125 |

for of

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 467 | 153 | 297 | | 2 | 463 | 158 | 198 | | 3 | 317 | 159 | 462 | | 4 | 321 | 159 | 212 | | 5 | 323 | 158 | 310 | | 6 | 320 | 158 | 149 | | 7 | 324 | 159 | 149 | | 8 | 323 | 158 | 148 | | 9 | 321 | 159 | 152 | | 10 | 324 | 158 | 151 | | Average | 350 | 158 | 223 |

chained

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 592 | 271 | 226 | | 2 | 607 | 315 | 216 | | 3 | 630 | 271 | 220 | | 4 | 602 | 315 | 218 | | 5 | 601 | 270 | 224 | | 6 | 603 | 314 | 226 | | 7 | 599 | 270 | 222 | | 8 | 601 | 313 | 225 | | 9 | 599 | 271 | 223 | | 10 | 599 | 315 | 232 | | Average | 603 | 293 | 223 |

fleti

| | chromium | firefox | webkit | | :---: | --- | --- | --- | | 1 | 704 | 267 | 205 | | 2 | 704 | 301 | 245 | | 3 | 704 | 301 | 245 | | 4 | 702 | 301 | 245 | | 5 | 711 | 302 | 247 | | 6 | 715 | 302 | 219 | | 7 | 704 | 302 | 221 | | 8 | 701 | 302 | 219 | | 9 | 701 | 301 | 222 | | 10 | 700 | 301 | 225 | | Average | 704 | 298 | 229 |