Why is processing a sorted array slower than an unsorted array?

When you are using the unsorted list all tuples are accessed in memory-order. They have been allocated consecutively in RAM. CPUs love accessing memory sequentially because they can speculatively request the next cache line so it will always be present when needed. When you are sorting the list you put it into random order because … Read more

When to use Vanilla JavaScript vs. jQuery?

this.id (as you know) this.value (on most input types. only issues I know are IE when a <select> doesn’t have value properties set on its <option> elements, or radio inputs in Safari.) this.className to get or set an entire “class” property this.selectedIndex against a <select> to get the selected index this.options against a <select> to … Read more

Performing a Stress Test on Web Application?

Here’s another vote for JMeter. JMeter is an open-source load testing tool, written in Java. It’s capable of testing a number of different server types (for example, web, web services, database, just about anything that uses requests basically). It does however have a steep learning curve once you start getting to complicated tests, but it’s … Read more

Why is there a large performance impact when looping over an array with 240 or more elements?

Summary: below 240, LLVM fully unrolls the inner loop and that lets it notice it can optimize away the repeat loop, breaking your benchmark. You found a magic threshold above which LLVM stops performing certain optimizations. The threshold is 8 bytes * 240 = 1920 bytes (your array is an array of usizes, therefore the … Read more