Top "Performance" questions

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

Java check if boolean is null

How do you check if a boolean is null or not? So if I know "hideInNav" is null. How do …

java performance boolean nullable
What is the fastest way to compare two sets in Java?

I am trying to optimize a piece of code which compares elements of list. Eg. public void compare(Set<…

java performance set
When to use CouchDB over MongoDB and vice versa

I am stuck between these two NoSQL databases. In my project I will be creating a database within a database. …

mongodb performance comparison couchdb nosql
How to remove all null elements from a ArrayList or String Array?

I try with a loop like that // ArrayList tourists for (Tourist t : tourists) { if (t != null) { t.setId(idForm); } } But …

java performance loops for-loop arraylist
Is Python faster and lighter than C++?

I've always thought that Python's advantages are code readibility and development speed, but time and memory usage were not as …

c++ python performance memory statistics
Fastest way to remove non-numeric characters from a VARCHAR in SQL Server

I'm writing an import utility that is using phone numbers as a unique key within the import. I need to …

sql sql-server performance optimization
Speed tradeoff of Java's -Xms and -Xmx options

Given these two commands A: $ java -Xms10G -Xmx10G myjavacode input.txt B: $ java -Xms5G -Xmx5G myjavacode …

java performance jvm-arguments
What is more efficient: Dictionary TryGetValue or ContainsKey+Item?

From MSDN's entry on Dictionary.TryGetValue Method: This method combines the functionality of the ContainsKey method and the Item property. …

c# performance dictionary
What is the most efficient way of finding all the factors of a number in Python?

Can someone explain to me an efficient way of finding all the factors of a number in Python (2.7)? I can …

python algorithm python-2.7 performance factorization
postgresql COUNT(DISTINCT ...) very slow

I have a very simple SQL query: SELECT COUNT(DISTINCT x) FROM table; My table has about 1.5 million rows. This …

performance postgresql count distinct