Re:Every time you click this link, it will send you to a ran...
by marginalia_nu on Sunday July 16, 2023 @05:06AM
(#36744972)
Prolly don't want to read the file on every request though
[ Parent
| on HN ]
Re:Every time you click this link, it will send you to a ran...
by pinkcan on Monday July 17, 2023 @02:21AM
(#36754754)
congratulations, you've optimised a snippet that never ran – it was typed into the post form from memory
Re:Every time you click this link, it will send you to a ran...
by marginalia_nu on Monday July 17, 2023 @06:08AM
(#36756126)
Premature optimization may sometimes be unadvisable, but in this case the optimized version uses half the memory, is two orders of magnitude faster, and doesn't let your users DOS you by triggering huge file reads on each request.
Re:Every time you click this link, it will send you to a ran...
by pinkcan on Monday July 17, 2023 @02:34PM
(#36762135)
> uses half the memory
this is false
> two orders of magnitude faster
incorrect
> doesn't let your users DOS you by triggering huge file reads on each request.
I understood what you were trying to do on your first reply – "Prolly don't want to read the file on every request though" – no need to repeat yourself.
plese remember:
1. it's pseudo code, the optimisation is superfluous
2. it never ran, the optimisation is useless
Re:Every time you click this link, it will send you to a ran...
by marginalia_nu on Tuesday July 18, 2023 @03:41PM
(#36778120)
Optimization is never useless. Even code that doesn't run is best written in a resource-effective manner.