For the single-threaded part of the curve to mesh conversion, avoid writing to two logically separate arrays in the same loop. Instead run the calculation on two separate threads if the output is large. Timing for `calculate_result_offsets` when processing 1 million curves: Before: Average: 10.4 ms, Min: 9.4 ms After: Average: 9.2 ms, Min: 7.7 ms