gopher-lua icon indicating copy to clipboard operation
gopher-lua copied to clipboard

large memory usage when index is very large in LTable

Open edolphin-ydf opened this issue 5 years ago • 2 comments

  • [x] GopherLua is a Lua5.1 implementation. You should be familiar with Lua programming language. Have you read Lua 5.1 reference manual carefully?
  • [x] GopherLua is a Lua5.1 implementation. In Lua, to keep it simple, it is more important to remove functionalities rather than to add functionalities unlike other languages . If you are going to introduce some new cool functionalities into the GopherLua code base and the functionalities can be implemented by existing APIs, It should be implemented as a library.

Please answer the following before submitting your issue:

  1. What version of GopherLua are you using? : latest
  2. What version of Go are you using? : 1.13
  3. What operating system and processor architecture are you using? : osx
  4. What did you do? : write a value to a LTable with very large int index
  5. What did you expect to see? : the k,v should be stored in LTable.dic
  6. What did you see instead? : the k,v stored in LTable.array and fill many many LNil before the index

hi, i'v seen #117 , but i think it could be optimized just like the c-lua which ensure at least more than 50% usage of the array. so, i'v tried to implement this feature by learned from c-lua. i could make a pr to show what i'v done with this if you agree with me

edolphin-ydf avatar Oct 30 '19 07:10 edolphin-ydf

hi~can you make a PR for that? I'm interested in your solution with this problem. @edolphin-ydf

myrfy001 avatar May 06 '20 14:05 myrfy001

@myrfy001 You can check it here https://github.com/edolphin-ydf/gopher-lua/tree/feature-table-setint with the 3 latest commits

edolphin-ydf avatar May 08 '20 07:05 edolphin-ydf