Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/graphitemaster/lua-vec
highly efficent, caching, copy-on-write lua vector math library
https://github.com/graphitemaster/lua-vec
Last synced: 3 months ago
JSON representation
highly efficent, caching, copy-on-write lua vector math library
- Host: GitHub
- URL: https://github.com/graphitemaster/lua-vec
- Owner: graphitemaster
- Created: 2019-01-26T10:07:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-26T10:16:00.000Z (almost 6 years ago)
- Last Synced: 2024-05-02T20:13:52.590Z (6 months ago)
- Language: Lua
- Size: 1.95 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- AwesomeCppGameDev - lua-vec - on-write lua vector math library (Scripting)
README
# lua-vec
Table constructions in Lua are expensive, creating and destroying
thousands of "vector" tables frame to frame in an engine can cause
serious performance problems when Lua's GC is triggered; this is a
vector library that attempts to solve this problem by interning
construction and reusing referencesIt's not safe to modify a vector that may be referenced multiple times
so this library also implements reasonably efficent read-only data types
through the use of `__index` metamethods.## performance
construction cost in the uncached case is ~2x more expensive but
the same in the cached case, the real winnings comes from not having a
destruction phase ever occur, e.g seeing 60% of GC frame to frame occur
because of one-off vector constructions go away is quite significant,
vector comparisons are ~20x faster since it's just object identity, i.e
pointer comparison in the VM.## memory
performance is made up by interning so if you're not careful you can
run out of memory rather quickly, make smart decisions when to call
`clear_cache()` on each of the vector caches.