4 ms·
If it helps you/the code (readability, DRYness, ...) then go for it. Avoiding it on the basis of guessing it would make a difference is a slippery slope down pr
by stephth 14y ago
If it helps you/the code (readability, DRYness, ...) then go for it. Avoiding it on the basis of guessing it would make a difference is a slippery slope down premature optimization hell [1]. I'd say code away, and when/if you need to optimize, use a profiler. Likely you'll be surprised at what makes a difference and what doesn't really.
edit:
[1] Note that by guessing I'm referring to any optimizations that don't involve profiling your project, and that includes benchmarks of Ruby style, which are interesting to observe and can help you learn certain things about Ruby but are deceiving as far as understanding what actually makes a difference in your project. The sane way to optimize is to profile.