5
\$\begingroup\$

This question should be considered as an expansion discussion on the policy discussed in Should comparisons of code snippets be closed as "not seeking a code review"?

For comparative reviews of two code snippets, should we consider questions which ask "reviewers" to determine which code snippet is faster to be off-topic?

For comparative reviews of two code snippets, should we consider questions which ask "reviewers" to determine which code snippet uses less memory to be off-topic?

\$\endgroup\$
  • 3
    \$\begingroup\$ I'm not a big fan of most of the comparative questions we receive. Mostly because these questions draw crud answers. \$\endgroup\$ – RubberDuck Aug 16 '14 at 18:29
  • \$\begingroup\$ @ckuhn203 But the community consensus is that they are on-topic. Now I'm asking for a community consensus on whether these sorts of comparative review questions are also on-topic. \$\endgroup\$ – nhgrif Aug 16 '14 at 19:13
2
\$\begingroup\$

For me, these questions should be closed as off-topic. They're somewhere in the area of asking about code not yet written, asking for an explanation, and failing to demonstrate a minimal understanding of the code the asker wants us to "review", which itself isn't strictly a close reason, but it certainly goes against the spirit of Code Review, I feel.

To be clear, I don't think a singular code snippet posted requesting a review along with a "I feel like this code runs slow and I'm interested in making it run faster" is off-topic (and the same for a similar request about reducing memory footprint).

I also think that speed and memory footprint are perfectly good things to review on CodeReview.

However, if you have two horses and you want to know which horse is faster and by how much, there's only one way to find out, right? Race them. And the same applies for memory footprints, but I don't have a good analogy for that one.

So, to answer the question about which is faster or which uses less memory, we first have to answer "How fast is Code Snippet A?" "How much memory does code Snippet A use?" This is what's really being asked. And these questions aren't really within the scope of Code Review. These are questions that are probably best asked on Stack Overflow as "How do I calculate the execution time of my source code?" or "How do I calculate the memory footprint of my source code?"

\$\endgroup\$

You must log in to answer this question.

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