huxingyi / meshlite

(Depreciated) meshlite is a library with focus on 3D mesh generating and processing in rust language.
MIT License
45 stars 5 forks source link

Optimize subdivide #4

Closed anderejd closed 6 years ago

anderejd commented 6 years ago

Before

faces     | vertices  | halfedges | edges     | verts/s   | time (ms)
----------+-----------+-----------+-----------+-----------+-----------
24        | 26        | 96        | 48        | 151543    | 0.12     
96        | 98        | 384       | 192       | 161348    | 0.45     
384       | 386       | 1536      | 768       | 169715    | 1.70     
1536      | 1538      | 6144      | 3072      | 178136    | 6.47     
6144      | 6146      | 24576     | 12288     | 170171    | 27.08    
24576     | 24578     | 98304     | 49152     | 167984    | 109.73   
98304     | 98306     | 393216    | 196608    | 163370    | 451.30   
393216    | 393218    | 1572864   | 786432    | 162916    | 1810.21  
1572864   | 1572866   | 6291456   | 3145728   | 158860    | 7425.69  
Vertices per second, min: 151543, max: 178136, avg: 164894

After

faces     | vertices  | halfedges | edges     | verts/s   | time (ms)
----------+-----------+-----------+-----------+-----------+-----------
24        | 26        | 96        | 48        | 172082    | 0.10     
96        | 98        | 384       | 192       | 275558    | 0.26     
384       | 386       | 1536      | 768       | 290359    | 0.99     
1536      | 1538      | 6144      | 3072      | 319219    | 3.61     
6144      | 6146      | 24576     | 12288     | 297132    | 15.51    
24576     | 24578     | 98304     | 49152     | 293099    | 62.89    
98304     | 98306     | 393216    | 196608    | 285825    | 257.95   
393216    | 393218    | 1572864   | 786432    | 279832    | 1053.89  
1572864   | 1572866   | 6291456   | 3145728   | 274094    | 4303.81  
Vertices per second, min: 172082, max: 319219, avg: 276356

Comparing the average vertices per second to the master branch it's a 68% increase in speed :slightly_smiling_face:

huxingyi commented 6 years ago

Great work!

anderejd commented 6 years ago

Thanks!