8
\$\begingroup\$

I've seen that lately the amount of questions regarding performance issues when using Javascript, jQuery, CSS3, etc. has increased.

Question is: Can we actually review them?

I'm edging towards no, with the following arguments:

  • Those type of performance issues are non deterministic, and are not always to be encountered even on the same PC. Some factors are simply CPU load, but also browser memory usage.
  • The performance will vary from PC to PC, I for example barely ever experience the issues described in the questions, so I couldn't possibly try to fix those issues without investing an unreasonable amount of effort by obtaining a lower end PC.

Note that these performance questions are very different from say, sorting a list, as there you can make algorithmic improvements (do not need to be measurable) and other measurable improvements, as there the programmer controls mostly what the code does.

An example of such question which I would not find appropriate to review is:
CSS3 transitions performance enhancement

I am unsure though for exactly which reason it would be off topic, perhaps some kind of reason as SO has, along the lines of "Could not be reproduced".

\$\endgroup\$
1
  • \$\begingroup\$ I am not a pro tester or anyting but I tested both and managed compare the performance of the method provided in the answer with the one in the question and found a significant difference. This should show it is possible to compare and therefore review the code to make it better : codereview.stackexchange.com/questions/58488/… \$\endgroup\$
    – web-tiki
    Aug 1, 2014 at 11:26

2 Answers 2

15
\$\begingroup\$

The performance will vary from PC to PC, I for example barely ever experience the issues described in the questions, so I couldn't possibly try to fix those issues without investing an unreasonable amount of effort by obtaining a lower end PC.

That is something I treat as a bad reason for disregarding performance issues. If it has to work smoothly for 90% of your expected users and it currently doesn't do so and the messy code is the reason, why would it be off-topic? So what that it works on your machine? If the question is valid as a Java question "I have this code, it's slow for some people, it's part of an applet, how do I increase performance, I think I did the looping here wrong" - why would the JS variant of that question be off-topic? Don't focus on reproducing the issue - focus on improving the performance.

Don't focus on making the code in a code review pass a certain standard, instead, focus on improving it.

Those type of performance issues are non deterministic, and are not always to be encountered even on the same PC. Some factors are simply CPU load, but also browser memory usage.

The problem is not always there. Hmm. Do we care? It's not stopping us from reviewing code, is it? You might say that the sought-after improvement is unnecessary. But if you start closing down performance questions for that reason, I think you could start cleaning house for a much larger amount of questions.

\$\endgroup\$
2
  • \$\begingroup\$ How can you test improved performance with Javascript code? In say Java you can measure your improvement in algorithms, but so far these Javascript questions seem to be purely about visual performance as in that it needs to look good, I do not see how that can be reviewed if both the original and the improved version look as good. \$\endgroup\$
    – skiwi
    Jul 30, 2014 at 10:44
  • 4
    \$\begingroup\$ Testing? Well, there'd be many ways. You could test how long the animation takes to complete. You could test how long it takes browsers to render a specific page. Heck, open up google chrome. Right clicky. Inspect element, move to the profiles tab. You can measure how long your browser spends on each line! \$\endgroup\$
    – Pimgd
    Jul 30, 2014 at 11:16
12
\$\begingroup\$

Let's reference our magic questions.

  • Is code included directly in my question?
    • Yup. It sure is.
  • Did I write that code myself?
    • Looks like it.
  • Is it actual code from a project rather than pseudo-code or example code?
    • Again, it's reasonable to think so.
  • Do I want the code to be good code? (i.e. not code-golfing, obfuscation, or similar)
    • Yes sir. That's why OP's here.
  • To the best of my knowledge, does the code work?
    • Let's assume so.
  • Do I want feedback about any or all facets of the code?
    • Who cares? We're going to review all aspects of it anyway.

Well, since it's not off-topic, it must be on-topic. Just because we don't know how to review it (yet) doesn't make it off topic.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ “a link with the embedded code is still okay” No, it's not, that should be changed on the help page. Though I guess it's just confusing wording. \$\endgroup\$
    – svick
    Jul 30, 2014 at 14:49
  • 1
    \$\begingroup\$ I think it's just poor phrasing. "A link along with the embedded code is still ok". \$\endgroup\$
    – RubberDuck
    Jul 30, 2014 at 14:52
  • 1
    \$\begingroup\$ @svick I've reworded the help page. \$\endgroup\$ Jul 30, 2014 at 18:44

You must log in to answer this question.

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