Slab icon indicating copy to clipboard operation
Slab copied to clipboard

Excessive garbage buildup

Open megagrump opened this issue 3 years ago • 11 comments

Parts of the code use temporary tables and string concatenation in every frame. This leads to huge buildup of garbage, sometimes megabytes per second.

As a first step to improve this, the use of temporary tables should be minimized. Example

Options = Options == nil and {} or Options

This should say

Options = Options or EMPTY

where EMPTY is a static, constant table that exists only once.

megagrump avatar Dec 20 '21 00:12 megagrump

Another example

This string should be cached in ActiveInstance if possible instead of regenerating it every time.

megagrump avatar Dec 20 '21 00:12 megagrump

Thank you! I'll work on this one

flamendless avatar Dec 20 '21 08:12 flamendless

After looking at the code in more detail I realize it's going to be a bit more complicated.

This part should use locals instead of modifiying the Options table (which would modify the Empty table if no options were given). I'm gonna make those changes to Button as a test to see if it works out.

megagrump avatar Dec 20 '21 08:12 megagrump

Great! I'll use your test as a reference as well

flamendless avatar Dec 20 '21 09:12 flamendless

Closed? What about the rest of the code, lol

megagrump avatar Dec 21 '21 08:12 megagrump

I thought it was the PR closed. My bad.

flamendless avatar Dec 21 '21 08:12 flamendless

  • [x] Button
  • [x] CheckBox
  • [ ] ColorPicker
  • [x] ComboBox
  • [ ] Dialog
  • [ ] Dock
  • [x] Image
  • [ ] Input
  • [ ] LayoutManager
  • [x] ListBox
  • [ ] Menu
  • [ ] MenuBar
  • [ ] MenuState
  • [x] Region
  • [ ] Seperator
  • [ ] Shape
  • [x] Text
  • [ ] Tooltip
  • [x] Tree
  • [x] Window
  • [x] DrawCommands

megagrump avatar Dec 21 '21 08:12 megagrump

FYI: I will stop contributing to any love2d related project, including this one. You can say thanks to slime for this. His inability to handle criticism, and him being a shitty person in general made me quit this community.

Can you undo all my commits to this project? I don't want to be part of it anymore.

megagrump avatar Jan 20 '22 14:01 megagrump

Ohhh sad to hear this. I'll take it from here then, thank you for the contributions.

~~About the undo, i dont think i can do this for the meantime due to work. You can undo it if you want. Pardon about that~~ Nvm i'll do it though my git knowledge is very limiting.

flamendless avatar Jan 21 '22 00:01 flamendless

Save the effort and leave them be, it's not important. I overreacted a little bit. No need to generate more work for you - no one would benefit from it.

megagrump avatar Feb 07 '22 18:02 megagrump

Sadly i already did a lot of work undoing them

flamendless avatar Feb 08 '22 07:02 flamendless