dda_queue.c: inline a simplified version of next_move().

As we're in an interrupt already, we can simplify the test for an
empty queue. Slowest step down to 446 clock cycles, another 26
ticks less. Binary size only 36 bytes up:

  ATmega sizes               '168   '328(P)   '644(P)     '1280
  Program:  19472 bytes      136%       64%       31%       16%
     Data:   2177 bytes      213%      107%       54%       27%
   EEPROM:     32 bytes        4%        2%        2%        1%

  short-moves.gcode statistics:
  LED on occurences: 888.
  LED on time minimum: 226 clock cycles.
  LED on time maximum: 403 clock cycles.
  LED on time average: 262.922 clock cycles.

  smooth-curves.gcode statistics:
  LED on occurences: 23648.
  LED on time minimum: 251 clock cycles.
  LED on time maximum: 446 clock cycles.
  LED on time average: 286.203 clock cycles.

  triangle-odd.gcode statistics:
  LED on occurences: 1636.
  LED on time minimum: 251 clock cycles.
  LED on time maximum: 403 clock cycles.
  LED on time average: 276.561 clock cycles.
This commit is contained in:
Markus Hitter 2016-11-22 02:20:23 +01:00
parent fc70e00ca2
commit 061924f448
1 changed files with 11 additions and 1 deletions

View File

@ -83,7 +83,17 @@ void queue_step() {
// Start the next move if this one is done.
if ( ! movebuffer[mb_tail].live) {
next_move();
/**
This is a simplified version of next_move() (which we'd use it it wasn't
so performance critical here).
queue_empty() used in next_move() needs no atomic protection, because
we're in an interrupt already.
*/
if (mb_tail != mb_head) {
mb_tail = MB_NEXT(mb_tail);
dda_start(&movebuffer[mb_tail]);
}
}
}