lua-users home
lua-l archive

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

> Which is why you would declare the table `constant', the same way you
> declare high-traffic variables `local', the same way C programmers of
> age misguidedly declared variables `register'.

Declaring a table constant makes no difference. Thee issue is the VARIABLE that refers to that table, not the fact that the table is references is constant or not. In my example, the compiler still has to trace the content of "t1" back to a constant declaration by (expensive) static analysis, regardless of it's "constness".

As I said, it's possible I've missed your point .. some code examples to illustrate your proposal would help.

> I do have to say that immutable tables could be vastly appreciated by the GC.

Won't make much difference to the GC; inbound references will still need to be traced, as will outgoing ones from the const table (though these would not change from GC pass to pass).

> IIRC, the JVM GC got a boost from allocating class tables differently
> than other data, seeing that they are constant.