Top "Performance" questions

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

Why is printing "B" dramatically slower than printing "#"?

I generated two matrices of 1000 x 1000: First Matrix: O and #. Second Matrix: O and B. Using the following code, the …

java performance loops for-loop system.out
Getting HTTP code in PHP using curl

I'm using CURL to get the status of a site, if it's up/down or redirecting to another site. I …

php performance curl http-headers
How do you calculate log base 2 in Java for integers?

I use the following function to calculate log base 2 for integers: public static int log2(int n){ if(n <= 0) …

java performance discrete-mathematics logarithm
How many threads is too many?

I am writing a server, and I send each action of into a separate thread when the request is received. …

multithreading performance threadpool
Is a view faster than a simple query?

Is a select * from myView faster than the query itself to create the view (in order to have the same …

sql sql-server performance
Best way to select random rows PostgreSQL

I want a random selection of rows in PostgreSQL, I tried this: select * from table where random() < 0.01; But some …

sql performance postgresql random
It is more efficient to use if-return-return or if-else-return?

Suppose I have an if statement with a return. From the efficiency perspective, should I use if(A > B): …

python c performance compiler-construction
delete all from table

what's faster? DELETE FROM table_name; or DELETE FROM table_name where 1=1; why? does truncate table work in access?

sql mysql ms-access optimization performance
How to find the kth largest element in an unsorted array of length n in O(n)?

I believe there's a way to find the kth largest element in an unsorted array of length n in O(…

performance algorithm big-o
HTTP vs HTTPS performance

Are there any major differences in performance between http and https? I seem to recall reading that HTTPS can be …

performance http https