How to speed up the OBJLoader?

Hi guys,

I have loaded the *.obj model which is around 30M into the three.js, and I need three of this *.obj.
1: Does it help if I clone the object instead of loading the *.obj file again?
2: How can I detect the object which already been loaded successfully?

I am a new to the three.js, hope to get some support and advice

Thank you!

Generally yes, cloning will save you a round trip of downloading and parsing the OBJ… however, browser caching will already speed up the second download, and there is also a caching mechanism built in to threejs set via:

THREE.Cache.enabled = true; that can avoid the parsing the second time… useful for situations where you don’t know if you have already loaded the object, thus don’t have a source to .clone() from, setting THREE.Cache.enabled can get you decent speedup for the second load/instantiation. So your instincts are correct, but there are multiple factors. :slight_smile: hth

1 Like

Hi manthrax,

Thanks a lot for your advice.
Unfortunately I am still using r56 which did not support THREE.Cache. :sweat_smile:

1 Like

All good. Any reason you want to use r56? That’s 11 years old !! and a lot has changed since then.

1 Like

Hi manthrax,

The only reason is that I am too lazy! I guess I have to upgrade to the latest version.

By the way, I have cloned the second and third object and it did speed up the initialization a lot.
May I ask you two more questions?
1: Which step will take more time to show the *.obj, loading the *.obj or rendering?
2: The *.obj will run with animation after proper loaded. Will this consume the browser continuously or how much it will affect the performance?