-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uses way too much memory. #44
Comments
Hi @Bobbyjoness, Thing is, I never wanted to dig much more in solutions to reduce the amount of memory used for one simple reason, it makes the code much more cleaner, and easier to maintain. And very convenient to me, as-is. But suggestions are welcome. See, I am not at all proficient in LuaJIT and ffi structs (since I haven't used it). Can you please explain in greater details what would be the benefit of offering support for ffit structs ? I might look into this direction, if promising. |
FFI structs use way less memory than a lua table. It's basically c structs. A 2d array of structs would use way memory. I'm not sure but maybe even a 2d array of ints/floats can be used. They don't have the overhead of a lua table. |
I know its the holidays but if you want I can help work on this issue now and make a PR. I just need to know what route you want to go to optimize the memory. This is really a critical issue for me because currently in my project it is using over 1gb of memory for a line of a distance 2000 with a node at each pixel. This is very important because there is a bug in luajit causing memory to be maxed out at 1gb on Linux and 2 on windows/osx. Just the one line that uses structs makes it use less than half the memory. Possibly the same can be done for the node class |
I have been looking at the code for the node class and the way it is used seems messy. This could be just my preference but it does not use getters and setters for all the fields it can have. This is an issue because for me to change the way node works I have to dig through all the code to find out what data the node class holds and how I could optimize it to use less memory. |
Bobbyjoness@1cc2b53 |
@Bobbyjoness I tested your optimization and it does not work reliable. Using the ASTAR algorithm it crashed after the calculation of one path. Using another algorithm just didn't work due to memory access errors. Error: /libs/jumper/core/node.lua:98: cannot convert 'nil' to 'float' |
I use Jumper, astar, for river generation and it uses way too much memory. I was wondering if its possible if you could do some internal optimization for memory. Some suggestions are allowing the user to use an ffi struct for the map data or if you didn't use a class for the nodes internally. Tables take up a large amount of memory so using a class for nodes makes it take up more memory than needed.
The text was updated successfully, but these errors were encountered: