lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Aug 9, 2021 at 4:49 PM tehtmi wrote:

Description of my answer, in rot13, in case anyone else wants to try:

Qrpyner n pbafg fgevat gung vf irel ybat. Gura qrsvar n ybg bs shapgvbaf gung hfr vg.

BTW, it's a great idea to use rot13 for spoilers.

A note concerning this optimization used by Lua:

The increased size of a bytecode is usually not a problem.
But increased loading of CPU cache is always a performance hit.
Assigning a non-internable string to a local const variable is cache-unfriendly in the current implementation of Lua: the constant string would exist as multiple copies in RAM and each copy would be cached independently.
I suggest to apply this optimization (to convert local const variables to real constants) only for internable strings.  Constant variables containing long strings should stay non-optimized in bytecode as if they were non-constant locals/upvalues.