Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • I think the problem is that it's not clear this question belongs here. It might be a better fit for stackoverflow. If you refocused on why this is the case, it might be more appropriate here. Commented May 20, 2020 at 18:25
  • Do either of these benchmarks produce any valid output (i.e. an actual sum of some non-trivial array or stack)? Because the pop version just looks like a bunch of no-ops. Commented May 20, 2020 at 20:03
  • @RobertHarvey, the jsBench example sums up the array values while the jsperf examples are bunch of no-ops. Commented May 20, 2020 at 20:13
  • @JimmyJames, I always viewed StackOverflow as a place for questions about the "how" of development. I posted this here hoping to find someone who could help me understand why this method would "measure" so much faster. Is this related the bench-marking tools, or does the reduction in array size on each iteration actually add up that much? Commented May 20, 2020 at 20:23
  • Related: Why is array.push sometimes faster than array[n] = value? Commented May 20, 2020 at 21:57