It's an interesting little program, but the question does not specify a specific problem. It states that the "algorithm seems unnecessarily complicated and time-consuming" and that "time is very important for my application".

But the asker never specifies the time constraint his program is under, or how much time his app is currently consuming. He doesn't specify the actual problem, nor give us a goal he is trying to achieve (for example, "It's taking 100ms, it must consume less than 50ms"). It's as if he's simply asking for others to help improve his code without any real requirement/problem.

I see questions like this quite often. It's hard to tell when the program is under a mandatory constraint (making it a problem fit for StackOverflow) or an optional constraint (it's not needed, but the asker wants improved performance for no mandatory reason).

My Question

Do I redirect the asker to CodeReview if they cannot supply a mandatory time constraint as well as the amount of time their program currently consumes? Or do I leave it on StackOverflow, even if a time constraint is never given?

It is the time of the year to get these questions, this is an end-of-semester project assignment. He won't tell that the perf deadline he needs to meet is the execution timeout on the machine that takes the submission and verifies if the program outputs the expected result. Codereview has a meta question about homework, sounds to me it would squeak by but rather doubtful they'll enjoy having to guess at the perf requirement. Best to do nothing.
– Hans PassantNov 22 '15 at 16:32

not enough for a real answer, but "Too slow" seems a specific enough problem statement IMO. In addition to that Code Review has something special: Answers aren't required to address OP's concerns (since they may be significantly misplaced). As such this question is IMO better off on SO, though it could use some love
– Vogel612Nov 22 '15 at 17:10

@HansPassant Code Review doesn't have a requirement that questions should say "it has to be faster than XYZ". Asking "How can this performance be improved?" is perfectly alright on Code Review.
– Simon ForsbergNov 22 '15 at 18:09

@SimonForsberg Thanks for the interesting link! What confuses me is how StackOverflow is labeled as "has a specific goal". As you mentioned, "How can this performance be improved?" would be acceptable here, since it's a goal, but apparently not a specific goal. Although the linked question in my post says it must be improved, it does not give any specific requirements. Should it be considered a review question?
– Vince EmighNov 22 '15 at 18:15

3

Speaking in a "wishy" way, not based on how things are or what's actually appropriate, I'd prefer to see questions like these kept on SO when posted to SO. CodeReview is cool but it's not just about, say, a micro-facet like speed or a very specific question related to design or coding-style, e.g. It's putting up your code and having each and every part analyzed, down to naming conventions, generality, coupling, cohesion, safety, efficiency, etc. etc. etc. The answers there can tend to be quite loaded -- SO keeps it focused on one very specific detail.
– Dragon EnergyNov 22 '15 at 23:29

2

By nature SO Q&As can tend to be quite a bit more general-purpose since they're not dissecting every single quality of a given piece of code. They tend to have a higher chance of producing interesting answers that might have some general applicability outside the very immediate context of the question or the example code shown.
– Dragon EnergyNov 22 '15 at 23:32