Skip to main content
27507 votes
25 answers
2.0m views

In this C++ code, sorting the data (before the timed region) makes the primary loop ~6x faster: #include <algorithm> #include <ctime> #include <iostream> int main() { // ...
GManNickG's user avatar
  • 506k
986 votes
24 answers
563k views

Most people with a degree in CS know what Big O stands for. It helps us to measure how well an algorithm scales. How do you calculate or approximate the complexity of your algorithms?
sven's user avatar
  • 18.4k
1754 votes
34 answers
949k views

Project Euler and other coding contests often have a maximum time to run or people boast of how fast their particular solution runs. With Python, sometimes the approaches are somewhat kludgey - i.e., ...
Chris Lawlor's user avatar
  • 49.5k
276 votes
9 answers
107k views

Let's say I specify an outputText component like this: <h:outputText value="#{ManagedBean.someProperty}"/> If I print a log message when the getter for someProperty is called and load the page, ...
Sevas's user avatar
  • 4,293
644 votes
34 answers
95k views

There are plenty of performance questions on this site already, but it occurs to me that almost all are very problem-specific and fairly narrow. And almost all repeat the advice to avoid premature ...
193 votes
1 answer
95k views

All the following instructions do the same thing: set %eax to zero. Which way is optimal (requiring fewest machine cycles)? xorl %eax, %eax mov $0, %eax andl $0, %eax
balajimc55's user avatar
  • 2,315
1468 votes
16 answers
1.1m views

There are various string formatting methods: Python <2.6: "Hello %s" % name Python 2.6+: "Hello {}".format(name)   (uses str.format) Python 3.6+: f"{name}"   (uses f-...
NorthIsUp's user avatar
  • 17.9k
244 votes
5 answers
70k views

I have seen many answers posted to questions on Stack Overflow involving the use of the Pandas method apply. I have also seen users commenting under them saying that "apply is slow, and should be ...
cs95's user avatar
  • 406k
4459 votes
56 answers
2.5m views

The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.? ...
333 votes
4 answers
117k views

By definition (at least from what I've seen) sargable means that a query is capable of having the query engine optimize the execution plan that the query uses. I've tried looking up the answers, but ...
DForck42's user avatar
  • 20.6k
102 votes
3 answers
17k views

LOOP (Intel ref manual entry) decrements ecx / rcx, and then jumps if non-zero. It's slow, but couldn't Intel have cheaply made it fast? dec/jnz already macro-fuses into a single uop on Sandybridge-...
Peter Cordes's user avatar
1127 votes
20 answers
520k views

Given the 2 toString() implementations below, which one is preferred: public String toString(){ return "{a:"+ a + ", b:" + b + ", c: " + c +"}"; } or public String toString(){ StringBuilder ...
non sequitor's user avatar
  • 18.9k
392 votes
13 answers
541k views

In Microsoft SQL Server how can I get a query execution plan for a query / stored procedure?
Justin's user avatar
  • 87.3k
16 votes
1 answer
4k views

I have a query running in a relational database that doesn't fulfill the expectation of the users. What information should I provide and what should I avoid, so that I can receive an effective help ...
Marmite Bomber's user avatar
3568 votes
78 answers
1.2m views

I have got a 2.67  GHz Celeron processor, and 1.21  GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android Emulator should start fairly quickly on such a machine, but ...

15 30 50 per page
1
2 3 4 5
858