[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4.2 New assorted suggestions (Part II)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 19 Nov 2020 10:41:57 -0300
> >> You know the first three rules of optimisation, right? They are, in order:
> >>
> >> 1. Measure
> >> 2. Measure
> >> 3. Measure
> >
> > Also:
> > 1. Don't.
> > 2. Don't... yet.
> > 3. Profile before optimizing
> >
> > See for instance
> > http://www.moscowcoffeereview.com/programming/the-3-rules-of-optimization/
>
> I’ll be honest .. I REALLY dislike this “premature optimization”
> aphorism. It (and rules like it) are often quoted as if they are laws
> of physics, when in fact they are at best vague generalizations.
>
> First, lua is already a *massively* optimized language, which is one
> of its attractions. The leanness of the language, VM, and libraries
> is a testament to that. So saying you should not optimize Lua seems
> dubious (I’m not defending the OPs changes, I’m talking in general
> here).
But Lua was not born massively optimized :-) All (or at least most :-)
optimizations were implemented following those rules. In fact, from
time to time, we remove some "optimizations" that do not seem to
be paying off (e.g., the "stackfull" implementation).
-- Roberto