dda_kinematics.c: note about unrolling loops.

Note a performance improvement opportunity.

Review note by Traumflug: the original commit didn't add a
comment, but replaced the existing code with what's in the
comment now.

According to the comment in issue #223:

Pre-unroll:
LED on time minimum: 3138.44 clock cycles.
LED on time maximum: 5108.8 clock cycles.
LED on time average: 4590.58 clock cycles.

Unrolled:
LED on time minimum: 3016.92 clock cycles.
LED on time maximum: 4987.28 clock cycles.
LED on time average: 4469.06 clock cycles.
This commit is contained in:
wurstnase 2016-06-24 20:04:24 +02:00 committed by Markus Hitter
parent 6cce9d173a
commit 280edf6dbc
1 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,17 @@ carthesian_to_carthesian(TARGET *startpoint, TARGET *target,
delta_um[i] = (uint32_t)labs(target->axis[i] - startpoint->axis[i]);
steps[i] = um_to_steps(target->axis[i], i);
}
/* Replacing the above five lines with this costs about 200 bytes binary
size on AVR, but also takes about 120 clock cycles less during movement
preparation. The smaller version was kept for our Arduino Nano friends.
delta_um[X] = (uint32_t)labs(target->axis[X] - startpoint->axis[X]);
steps[X] = um_to_steps(target->axis[X], X);
delta_um[Y] = (uint32_t)labs(target->axis[Y] - startpoint->axis[Y]);
steps[Y] = um_to_steps(target->axis[Y], Y);
delta_um[Z] = (uint32_t)labs(target->axis[Z] - startpoint->axis[Z]);
steps[Z] = um_to_steps(target->axis[Z], Z);
*/
}
void