This would probably give you a bigger speed increase than acceleration planning would and would love to see this. When I first started with CNC a couple of years ago, I was able to shave a lot of time off a cut just by optimizing the gcode. I had found a shareware program online and it worked pretty well, but I think it fails if you try to do a tool change… so you have to break each tool into individual files.
There likely are better optimizers out there and if you can find python code for one, that would be awesome.