Top "Optimization" questions

Optimization is the act of improving a method or design.

GROUP BY having MAX date

I have problem when executing this code: SELECT * FROM tblpm n WHERE date_updated=(SELECT MAX(date_updated) FROM tblpm …

mysql sql optimization greatest-n-per-group
Why does C++ code for testing the Collatz conjecture run faster than hand-written assembly?

I wrote these two solutions for Project Euler Q14, in assembly and in C++. They implement identical brute force approach …

c++ performance assembly optimization x86
Different ways of adding to Dictionary

What is the difference in Dictionary.add(key, value) and Dictionary[key] = value? I've noticed that the last version does …

c# optimization dictionary
What is the most "pythonic" way to iterate over a list in chunks?

I have a Python script which takes as input a list of integers, which I need to work with four …

python list loops optimization chunks
Declaring variables inside or outside of a loop

Why does the following work fine? String str; while (condition) { str = calculateStr(); ..... } But this one is said to be dangerous/…

java optimization while-loop
Flatten an irregular list of lists

Yes, I know this subject has been covered before (here, here, here, here), but as far as I know, all …

python list optimization nested-lists flatten
Ternary operators in JavaScript without an "else"

I've always had to put null in the else conditions that don't have anything. Is there a way around it? …

javascript optimization syntax-error
Most efficient way to see if an ArrayList contains an object in Java

I have an ArrayList of objects in Java. The objects have four fields, two of which I'd use to consider …

java algorithm optimization search arraylist
Is the ternary operator faster than an "if" condition in Java

I am prone to "if-conditional syndrome" which means I tend to use if conditions all the time. I rarely ever …

java performance optimization
How do you test running time of VBA code?

Is there code in VBA I can wrap a function with that will let me know the time it took …

optimization testing vba profiling performance