Vadoola / dxf2elmt

A CLI program to convert .dxf to .elmt
MIT License
1 stars 2 forks source link

Could parallelization be added? #6

Open Vadoola opened 3 months ago

Vadoola commented 3 months ago

If I add the ability to pass in multiple DXF files for converting, I could easily parallelize that. is there a way to parallelize if it's only operating on one file? such as iterating over the DXF elements in parallel?

Vadoola commented 1 month ago

So I did a quick test, importing rayon, and adding a .par_bridge into the iterating over the drawing entities. Since the iteration happens over non-mutable references there are no real issues with sending it across thread boundaries. It my quick rough tests I found on more complex drawings I was getting about a 5-7% improvement in performance, although in very simple ones I saw a decrease by maybe 2%. This would make sense because on the simple drawings the overhead of setting up the threads is more than the benefit gained.

The question is the extra possible complexity (and I would assume bigger executable size from pulling in rayon, but I didn't check) worth the small performance benefit? Of course there may be other way to utilize parallelization and improve the performance more, this was just a super quick test to check my assumptions, and see if there were any pain points that I hadn't considered.