Top "Performance" questions

For questions pertaining to the measurement or improvement of code and application efficiency.

Array or List in Java. Which is faster?

I have to keep thousands of strings in memory to be accessed serially in Java. Should I store them in …

java arrays list performance
How to quickly clear a JavaScript Object?

With a JavaScript Array, I can reset it to an empty state with a single assignment: array.length = 0; This makes …

javascript performance
Which Python memory profiler is recommended?

I want to know the memory usage of my Python application and specifically want to know what code blocks/portions …

python performance memory-management profiling
Fastest way to iterate over all the chars in a String

In Java, what would the fastest way to iterate over all the chars in a String, this: String str = "a …

java string performance char iteration
Check if a string contains an element from a list (of strings)

For the following block of code: For I = 0 To listOfStrings.Count - 1 If myString.Contains(lstOfStrings.Item(I)) Then Return …

c# vb.net list coding-style performance
Why is 2 * (i * i) faster than 2 * i * i in Java?

The following Java program takes on average between 0.50 secs and 0.55 secs to run: public static void main(String[] args) { long …

java performance benchmarking bytecode jit
Exact time measurement for performance testing

What is the most exact way of seeing how long something, for example a method call, took in code? The …

c# .net performance testing
Static linking vs dynamic linking

Are there any compelling performance reasons to choose static linking over dynamic linking or vice versa in certain situations? I've …

c++ c performance static-linking dynamic-linking
Condition within JOIN or WHERE

Is there any difference (performance, best-practice, etc...) between putting a condition in the JOIN clause vs. the WHERE clause? For …

sql performance
Why are elementwise additions much faster in separate loops than in a combined loop?

Suppose a1, b1, c1, and d1 point to heap memory and my numerical code has the following core loop. const …

c++ performance x86 vectorization compiler-optimization