18
\$\begingroup\$

So we already have questions of the type "Tips for Golfing in XXX" and these are accepted as on-topic.

My question is would any question of the type

"Tips for [time/memory/any]-optimization [in language XXX]"

be on-topic here.

This could include things like:

  • "Tips for time-optimizing in Rust"

  • "Tips for optimizing in Rust"

Answers might look like:

"Rust doesn't use tail end recursion optimization. Iteration will almost always be faster than recursion." (<-- may or may not be true)

It seems to me that since golfing tips are on-topic, optimization tips should also be. The counterargument that I can see is that optimization is a well studied subject with tomes upon tomes written about it. Golfing is not and this website is one of the few resources for golfing.

\$\endgroup\$
6
  • 6
    \$\begingroup\$ I feel like we've had this discussion before and your last paragraph was the main argument for why it's not a good idea. Not only that speed and memory optimisation are much more well explored, they are also much broader topics and largely language agnostic and also very problem specific. \$\endgroup\$ Mar 5, 2016 at 10:57
  • \$\begingroup\$ We talked a bit about this in chat, and that was brought up. Geobits said " I didn't think we judged the broadness of a question on whether it is also answered elsewhere." Which I think is a valid point. \$\endgroup\$
    – Liam
    Mar 5, 2016 at 19:28
  • 6
    \$\begingroup\$ That's not what I mean. "Tips for golfing in X" can be covered within the scope of a (list-y) SE question. "Tips for optimising programs in X" can be covered within the scope of a book or ten (imho). \$\endgroup\$ Mar 5, 2016 at 19:30
  • 2
    \$\begingroup\$ I agree that optimization tips would be very broad. What I'm not convinced of is that it is considerably broader than tips for golfing. I think tips for golfing questions fit in a list-y format because we make them. \$\endgroup\$
    – Liam
    Mar 5, 2016 at 19:46
  • 3
    \$\begingroup\$ Related. \$\endgroup\$
    – cat
    Mar 8, 2016 at 16:10
  • 1
    \$\begingroup\$ A seemingly obvious answer could be "Most of the optimisations will be premature so this should be off topic". However, many of the golfing tips will be wasted if applied prematurely (shaving off bytes prior to a major change in algorithm that discards that part of the code), so I'm not sure how much of a distinction there should be here. \$\endgroup\$ Mar 8, 2016 at 21:43

1 Answer 1

4
\$\begingroup\$

Yes, but...

As Martin Ender (among others) has pointed out, there is oftentimes volumes of literature already written about such topics. It's simply not possible to fit all (or even a useful subset) of that information into a single usable post.

Therefore, a question such as "Tips for time-optimization in Python/C/Java/Rust/etc." would (and IMHO should) be closed as "too broad."

There are a few things that could be done to narrow the scope of such a question:

  • You could make it into a question about a specific piece of code (in the same way that these sorts of golfing questions are on-topic), but this might be better suited to Code Review.

  • You could make it into a question about a specific language feature, or at least a feature which has optimization characteristics specific to the given language (e.g. "When to use static vs. dynamic dispatch to get best preformance in Rust"). This might be better suited to Stack Overflow, but it would probably be on-topic and useful here as well.

  • It might be possible to make a question that was language-agnostic (or at least generalized to a certain category of languages), but even this would need some specialization.

If a person wanted to ask a question like that in PPCG, it was probably because they were trying to solve a challenge on PPCG, and had a specific problem that they wanted to solve. The best thing to do is to identify this problem and ask about it specifically, rather than asking an unhelpful and overly broad question that probably won't even provide an answer useful to the OP.

\$\endgroup\$

You must log in to answer this question.

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