trishume / QuestSaberPatch

Patcher tool to add custom levels to the Oculus Quest version of Beat Saber
MIT License
64 stars 8 forks source link

Merge paralleization commits back in #9

Closed leo60228 closed 5 years ago

leo60228 commented 5 years ago

These somehow got removed.

trishume commented 5 years ago

Just an update on why I haven't merged this. I basically don't like how this approach to parallelization of beatmap formatting works, especially since it doesn't correctly handle errors at all stages of the process and enable just skipping broken levels instead of crashing the whole process.

I also don't want any of the optimizations other than parallel BinaryFormatter, because I'm pretty sure they either have no effect or make things worse, at the cost of more complex code. For example the entire writing out stage takes 85ms for me, and that's dominated by the cost of copying large arrays of bytes, parallelizing adds more byte copying while still having the same serialized byte copying, so I expect it makes it slower, and even if it does make it faster it's such a tiny part of overall time that it's not worth the code complexity to optimize.

trishume commented 5 years ago

I'm going to try to think of a clean way to parallelize it, but I also might just give up and figure out the BinaryFormatter format and write a custom writer for it which should be 10-100x faster, making parallelization unnecessary.

trishume commented 5 years ago

Aaaand this just got obsoleted since it turns out v1.1.0 switched to just the straight new format JSON for included Beatmaps so serialization will no longer be slow.