Do these questions belong on SO or Code Review? I would say Code Review, since it is for improving the code, but...
thus I felt I should ask.
Stimulus: https://stackoverflow.com/questions/36221561/how-can-i-change-this-code-to-be-more-efficient
Do these questions belong on SO or Code Review? I would say Code Review, since it is for improving the code, but...
thus I felt I should ask.
Stimulus: https://stackoverflow.com/questions/36221561/how-can-i-change-this-code-to-be-more-efficient
I disagree with the general sentiment that these questions are appropriate for Stack Overflow. If they fall within the guidelines for codereview, they should be asked there. Generally, if I see these questions on Stack Overflow, I choose the following close reason:
Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example.
That's really important enough for questions on Stack Overflow that the bolded part should be its own close reason.
Here's why I think those questions are off topic for Stack Overflow (but on topic for code review, their guidelines notwithstanding):
These questions typically have a title that no one would ever search for with their issue. If we believe Stack Overflow is built to expand the sum total of programming knowledge, then a question that can't be found can't add to that knowledge. And that's not theory, that's a practical concern when the vast majority of our traffic comes from search.
The questions also typically lack any programming terminology or algorithmic concepts that would help searchers to find them. This typically stems from the people asking them not understanding enough of what they're trying to do to actually ask a good question in the first place.
Due to the two problems above, the answers typically are very localized to the specific question asked; and it's hard to generalize any answer for others without completely reworking the question and the answer.
These questions should be closed; and the asker should be pointed to code-review's guidelines. I'd love to migrate them to codereview, but the CR community typically takes a dim view of that.
We at Code Review made this page on our Meta specifically for answering the question above, which has been asked many times:
It depends on what type of answer the asker is looking for - if the goal is to fix the performance issue, and any other improvements are noise, then Stack Overflow it is.
If the goal instead is to "improve my code" in general, then Code Review is a better fit - Stack Overflow is on topic as well, if you were to provide an actual question ("What's your problem with this piece of code?").
And of course, code dumps without explanation are off-topic on both.
A question, like the one that you provided, that just dumps a bunch of code and says, "make it more efficient" is going to be Too Broad on SO (as well as Unclear). It's possible that you could focus the question by adding more details, such as by narrowing the scope of the problematic code as much as possible, to the piece that is taking unacceptably long, explaining what it's doing that seems superfluous and/or inefficient, what other approaches were considered for how to solve the problem, and why they didn't work.
The problem would also need clear guidelines for what is "too slow" and what is "good enough". If you do all of that it's possible that the scope of the problem could b narrowed enough that you could conclusively state whether or not a given answer successfully answers the question, and ensuring that such an answer wouldn't need to be enormous.
You're more than welcome to ask on Code Review's meta, after looking through their help center, if such a question is acceptable, or what it would take to make such a question acceptable (since I assume it wouldn't make a good CR question for exactly the same reason it's not a good SO question, but I'm not a CR regular).