gpvigano / AsImpL

Asynchronous Importer and run-time Loader for Unity
MIT License
212 stars 37 forks source link

Dangerous load balancing #42

Closed Bunny83 closed 4 years ago

Bunny83 commented 4 years ago

https://github.com/gpvigano/AsImpL/blob/698f024bdd7397f0684090882493592a5dcfcf70/Assets/AsImpL/Scripts/Loaders/LoaderObj.cs#L351-L356

This "load balancing block" that is currently at the end of the for loop should be placed at the top. Since the for loop might skip certain iterations (comments, empty lines) and we just yield every 7000th iteration we can be unlucky with the placement of comments or empty lines and might doing several multiples of 7k iterations before we hit a yield. In the worst case we would never yield.

This gives inconsistent performance results depending on the input file.

gpvigano commented 4 years ago

This last commit should be a fix for this issue. Let me know if you disagree.

Bunny83 commented 4 years ago

Yep, this should solve the issue 👍