donovan6000 / M33-Fio

The ultimate OctoPrint plugin
GNU General Public License v3.0
125 stars 38 forks source link

various speed improvements #77

Closed TonyLHansen closed 8 years ago

TonyLHansen commented 8 years ago

Here are my speed improvements for gcode that I've been promising you. :-)

My tests with the old gcode.cpp vs the new gcode.cpp show that it runs 15-25% faster. Here is a test with a 34458619 gcode file. The copy() test does parseline and an ostream <<. The mod_center() test does a parseline, gets and sets the G/X/Y/E values, and an ostream <<. The first run is with "g++ -pg" and the 2nd run is without "-pg":

==> n1/big.out-old <== copy(big.gcode) took 111.47 seconds of processing mod_center(big.gcode) took 220.44 seconds of processing

==> n1/big.out-new <== copy(big.gcode) took 83.72 seconds of processing mod_center(big.gcode) took 181.44 seconds of processing

83.72 / 111.47 = .75105 = 25% improvement 181.44 / 220.44 = .82308 = 18% improvement

==> n2/big.out-old <== copy(big.gcode) took 117.89 seconds of processing mod_center(big.gcode) took 229.54 seconds of processing

==> n2/big.out-new <== copy(big.gcode) took 99.76 seconds of processing mod_center(big.gcode) took 200.74 seconds of processing

99.76 / 117.89 = .84621 = 15% improvement 200.74 / 229.54 = .87453 = 13% improvement