I was browsing through this question and it made me realize a trend: almost all questions which relate to performance improvements are immediately under fire and hotly debated over whether the OP should even bother asking the question. Half of the community will say something like "This doesn't concern you; let the compiler do its job", while the other half rages back, saying, "We can't just ignore performance and hope the optimizer does all the work for us."

The question linked above is a good cross-section of this phenomenon; it has 17 upvotes and 3 close votes as of now.

Hence the question, as there doesn't seem to be a consensus: are these types of questions on-topic or not?

(Also, I know that I need a sample size greater than one to claim that there's a trend, but I don't have time to look up all the other questions I've seen like this at the moment. The one most recently that I remember having similar discussion/debate about was about "the fastest way to tell if two ints are on the same side of zero" or something.)

  • if op provide reason why he wants to do that .... and performance is issue in that task ... then it may be helpful for both op and feature visitor Jun 14 '13 at 2:14
  • @NullPoiиteя Personally, I agree that it's constructive. The accepted answer in that post is a pretty clever trick, and the OP's comment under it explains the huge performance boost from using it. But I'm curious what the authorities rule on the subject.
    – asteri
    Jun 14 '13 at 2:16
  • just waiting for last close vote ... and going to cast reopen vote Jun 14 '13 at 2:19
  • @Jeff: You can't always rely on someone posting a stellar answer to save an otherwise unconstructive question. Questions need to stand on their own merits; for every mundane question that stumbles into an interesting answer, there are 99 others that we don't necessarily leave open on the off-chance that someone might have some golden nugget to redeem it.
    – user102937
    Jun 14 '13 at 5:00

From what I've seen, questions tend to fall into 4 categories:

  • My code is slow. Make it faster.
  • What is the fastest way to do X?
  • Is A faster than B?
  • Why is A faster than B? (with evidence showing that A is actually faster than B)

My code is slow. Make it faster.

These are usually very localized and have a high tendency to get migrated to Code Review.

These questions aren't too different from the bulk of the debugging questions that flood SO. (the suitability of which is still a somewhat highly debated issue)

What is the fastest way to do X?

Anything that has words like "best" in the title cries for the usual opinion-based "Not Constructive". However, I don't agree that is the case for performance questions.

Every solution can be benchmarked to see where it stands with all the other answers. So every answer can be evaluated objectively.

In my opinion, these are on topic and constructive - even if they generate a large number of answers.

Is A faster than B?

These have a high tendency to be closed as "Not a Real Question" or "Not Constructive" because of a lack or research effort or a misguided basis.

Depending on how they are phrased and the answers they receive, I've seen these appear on both extremes of "really bad" and "really good". (everything from +500 to -20)

Why is A faster than B?

These, when backed up with evidence, tend to be extremely high quality questions.

It's not uncommon for a performance question of this type to go viral.

Ultimately, performance questions aren't inherently different from other tags. They are perfectly suitable for Stack Overflow. It's just that the all too common cry of "stupid", "pointless", and "premature" tends drive people to close otherwise good performance questions.

  • +1 perfect explanation ... Jun 14 '13 at 2:28
  • 2
    +1 seconded. I think many performance questions are on topic and very valuable in building knowledge and experience for programmers generally.
    – nickhar
    Jun 14 '13 at 2:55
  • Sorry, regarding the first category, did you mean "aren't" or did you mean what you typed?
    – user200500
    Jun 14 '13 at 3:34
  • @Asad I meant what I wrote. And to clarify I believe that they are on-topic for both SO and codereview. So they don't need to be migrated.
    – Mysticial
    Jun 14 '13 at 3:40
  • If they are extremely localised, wouldn't that suggest they aren't suitable for SO?
    – user200500
    Jun 14 '13 at 3:44
  • @Asad I agree with you there. But I would say they are no different from the vast majority of the debugging questions we get on SO.
    – Mysticial
    Jun 14 '13 at 3:48
  • It's just that the all too common cry of "stupid", "pointless", and "premature" tends drive people to close otherwise good performance questions. -- [citation-needed]
    – user102937
    Jun 14 '13 at 4:54
  • @RobertHarvey I'm not sure what kind of "citation" you're looking for, but the question linked by the OP is an example of where it happened.
    – Mysticial
    Jun 14 '13 at 4:57
  • @Mysticial: The linked question is not an especially great one. Are there any better examples? See the comment I posted below the question: meta.stackexchange.com/questions/184369/…
    – user102937
    Jun 14 '13 at 5:01
  • @RobertHarvey Here's a borderline one. The question itself isn't great, but the answers are good. I can think of two more examples that IMO were improperly closed, but not for the exact reason you're looking for. Most the ones that I encounter casually are hard to find since they are low in votes.
    – Mysticial
    Jun 14 '13 at 5:05
  • I agree with the closure on that one. It would seem that performance questions attract good answers because programmers are morbidly curious about them and are willing to take the time to research them properly. It's too bad they don't always feel the same way about other questions that don't pose the same kind of tantalizing puzzle. Let's face it; the branch prediction one is extremely interesting, but how often is someone actually going to face that highly localized scenario IRL?
    – user102937
    Jun 14 '13 at 5:06

Yes. I say they are.

More than that, I think they're very educational.

Some of the most interesting questions in SO are about performance.

Performance is an inherent part of programming. The fact the community consistently up-votes interesting performance questions shows that these questions have a place here.

Again, as long as they're not too localized, ambiguous, open for discussion or any other thing that might cause a question to not be a good fit for stackoverflow.

  • 1
    that could be bad question having great answer.... it would be great if mod lock this question and prevent from deletion Jun 14 '13 at 2:28

Not the answer you're looking for? Browse other questions tagged .