Making all the various Hitable structs to contain a reference &Material instead of owning their own Copy of a Material.
Cons: This sadly requires spamming quite a lot of <'scene> lifetimes around
Pros: This reduces the memory usage on some scenes quite significantly - directly proportional to the amount of triangles using a shared material
this branch
just cli -i scenes/dragon.json 714.97s user 3.72s system 713% cpu 1:40.78 total
64M reserved
just cli -i scenes/gltf_scifi_helmet.json 535.42s user 2.65s system 736% cpu 1:13.04 total
122M reserved
main 305d52388fe2067bf93f7fdc4a804cf00e8eb3bc
just cli -i scenes/dragon.json 728.58s user 5.51s system 733% cpu 1:40.13 total
150M reserved
just cli -i scenes/gltf_scifi_helmet.json 544.08s user 4.35s system 722% cpu 1:15.90 total
132M reserved
There's still a lot of additional work to do in later PRs - e.g.
removing the last uses of Box::leak
having a separate materials list in the scene format and objects having references to it
hopefully cleaning up the code a bit, it is rather messy right now
Making all the various
Hitable
structs to contain a reference&Material
instead of owning their ownCopy
of aMaterial
.Cons: This sadly requires spamming quite a lot of
<'scene>
lifetimes around Pros: This reduces the memory usage on some scenes quite significantly - directly proportional to the amount of triangles using a shared materialthis branch
main 305d52388fe2067bf93f7fdc4a804cf00e8eb3bc
There's still a lot of additional work to do in later PRs - e.g.
Box::leak