PLY performance improvements #20
Labels
area:IO
Area: IO
category:improvement
Category: Improvement
category:performance
Category: performance/speed
difficulty:hard
Difficulty: hard
priority:low
Priority: Low
status:ready
Status: this issue can be worked on now
PLY reading and writing speed is not bad, but could be improved a lot. The difficult part is that PLY has a dynamic type system, so to say: we have to read the header to know what types to expect. This leads to a lot of complexity everywhere.
I have two main ideas how to improve PLY speed.
(a)
RawSource
has to be changed. Currently it is forced to write to the "serializer" once for each property. That means we cannot do any optimizations such as "have a temporary buffer with all vertex properties and write to the writer only once per vertex". This is bad. So this certainly needs to be improved.(b) And here is where it gets funny: write a JIT codegen. The optimal assembly code to read "normal" binary PLY files is actually super simple. It's just a memcopy, mostly. However, due to the fact that the data layout is dynamic, the Rust compiler can't do any optimizations in that regard. So the idea is to generate x86-64 machine code after reading the PLY header. This code is then optimized for the PLY data layout. I bet this could increase raw read performance at least five-fold if not a lot more. But it's a lot of work and
unsafe
code and platform-dependent stuff and and and. Not sure if worth it -- it would be a super interesting project though.The text was updated successfully, but these errors were encountered: