ThatOpen / engine_web-ifc

Reading and writing IFC files with Javascript, at native speeds.
https://thatopen.github.io/engine_web-ifc/demo
Mozilla Public License 2.0
617 stars 190 forks source link

How to do multithreading in node.js? #187

Closed tafaust closed 2 years ago

tafaust commented 2 years ago

Hey, thank you for all the effort that went into this brilliant project!

I am loading properties from .ifc files in Node.js. However, with files greater 2MB, the loading takes forever and it merely uses a single core.

I was wondering if there is a way to multithread loading in node.js? Thank you!

Here is the file I'm trying to load: haus.ifc

tomzeppenfeldt commented 2 years ago

Yes there are ways to multithread Node.js ( among onthers https://levelup.gitconnected.com/multithreading-with-nodejs-is-reality-10871986b8a9) , but you may be facing other issues in loading a 2MB ifc takes "forever". In our platform (Graphileon), which is also using IFCjs with Node.js, file loading of your haus.ifc is instantaneous , as is property retrieval.

tafaust commented 2 years ago

Thank you @tomzeppenfeldt. So, apparently, my question does not directly qualify for a github issue but allow me one more question: Were you able to parallelize loading the lines with web-ifc builtin features? Comparing web-ifc with web-ifc-three, the former lacks a manager to coordinate the worker_threads. I assume that is part of your platforms secret sauce? ;)

Thank you for the quick reply! Good to hear that it is an issue with me. 😅

tafaust commented 2 years ago

One a further side note, I started my IFC loader program in Intellij with debugging and apparently that was causing huge performance issues.