Is your feature request related to a problem? Please describe.
We Hubs (more precisely underlying A-Frame) enables Three.js Cache which saves the file contents downloaded with Three.js loaders in JavaScript level in heap memory.
But I think browser also saves the cache and it should work fine. So JavaScript level cache may be useless.
And JavaScript level cache unnecessarily wastes heap memory. File contents cache can be one of the huge memory consumption in Hubs Client.
I tried to measure the benefit of disabling the Three.js Cache with a very easy way.
- On the local Hubs server, I joined a room with "Moz Atrium" scene.
- Take heap memory snapshot on Windows10 Chrome
- Run THREE.Cache.clear() on the web console (thanks for global
THREE)
- Take heap memory snapshot again
Result:
Before clearing Three.js Cache: 117.0MB
After clearing Three.js Cache: 75.3MB
I cut off 35% heap memory consumption by just clearing the Cache. The effect would be greater if a lot of medias, objects, and avatars are placed especially in a longer event where people tend to be place (and remove) a lot of objects over time.
Describe the solution you'd like
Disable Three.js Cache. It is disabled by default in Three.js so it can be done by removing THREE.Cache.enabled = true line from A-Frame code.
Describe alternatives you've considered
If we want to enable Three.js Cache for certain reasons, we should remove the file contents which unlikely be used again from Cache by THREE.Cache.remove(url).
Additional context
There may be some codes in A-Frame which expects and relies on that Three.js Cache is enabled. Just in case we should carefully check and review such codes. (But we may not need to be worried about it since we use very little of the built in stuff now.)
I'm thinking of starting to work on this after #4198 is merged.
Is your feature request related to a problem? Please describe.
We Hubs (more precisely underlying A-Frame) enables Three.js
Cachewhich saves the file contents downloaded with Three.js loaders in JavaScript level in heap memory.But I think browser also saves the cache and it should work fine. So JavaScript level cache may be useless.
And JavaScript level cache unnecessarily wastes heap memory. File contents cache can be one of the huge memory consumption in Hubs Client.
I tried to measure the benefit of disabling the Three.js
Cachewith a very easy way.THREE)Result:
Before clearing Three.js Cache: 117.0MB
After clearing Three.js Cache: 75.3MB
I cut off 35% heap memory consumption by just clearing the
Cache. The effect would be greater if a lot of medias, objects, and avatars are placed especially in a longer event where people tend to be place (and remove) a lot of objects over time.Describe the solution you'd like
Disable Three.js
Cache. It is disabled by default in Three.js so it can be done by removingTHREE.Cache.enabled = trueline from A-Frame code.Describe alternatives you've considered
If we want to enable Three.js
Cachefor certain reasons, we should remove the file contents which unlikely be used again fromCachebyTHREE.Cache.remove(url).Additional context
There may be some codes in A-Frame which expects and relies on that Three.js
Cacheis enabled. Just in case we should carefully check and review such codes. (But we may not need to be worried about it since we use very little of the built in stuff now.)I'm thinking of starting to work on this after #4198 is merged.