Skip to content

pocomane/lua-length-patch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4,989 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is thoughtless-patch to lua that keeps a length field in the C struct of the table. It behaves as the following:

  • A length is kept in a new field of the table struct (intialized to 0)
  • Length-operator/opcode return it
  • The length is changed every time something is written in t[#t+1] (nil also).
  • ipairs loops from 1 to this length, also if there are holes
  • The table.setlen function can be used to set the value of the new field. It does not change anything else.

The execution time increases by ~1% (when updating the length) while the memory size increases by ~8% (when storing empty tables).

About

Toy patch to lua. It keeps the table length as an field of the C table struc. It is based on the Lua repo, as seen by the Lua team.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C 95.2%
  • C++ 3.0%
  • Other 1.8%