flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
289 stars 25 forks source link

Excessive garbage buildup #103

Open megagrump opened 2 years ago

megagrump commented 2 years ago

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 commented 2 years ago

Another example

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

flamendless commented 2 years ago

Thank you! I'll work on this one

megagrump commented 2 years ago

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.

flamendless commented 2 years ago

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

megagrump commented 2 years ago

Closed? What about the rest of the code, lol

flamendless commented 2 years ago

I thought it was the PR closed. My bad.

megagrump commented 2 years ago
megagrump commented 2 years ago

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.

flamendless commented 2 years ago

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.

megagrump commented 2 years ago

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.

flamendless commented 2 years ago

Sadly i already did a lot of work undoing them