Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize buffer_line by calculating before wait-for-free-block #5115

Merged

Conversation

thinkyhead
Copy link
Member

This optimization of buffer_line moves the wait-for-buffer test farther down so that calculations that don't need to write to the block can occur ahead of time. This saves lots of time because the calculations will already have been done when the block finally becomes available. Significantly more time may be saved by doing other expensive calculations earlier also.

@Roxy-3D
Copy link
Member

Roxy-3D commented Oct 29, 2016

I agree! It basically gives us back the CPU cycles to process one command. However... The only time it gives us these CPU cycles is when the Planner's buffer is already full...

@thinkyhead
Copy link
Member Author

thinkyhead commented Oct 30, 2016

The only time it gives us these CPU cycles is when the Planner's buffer is already full...

@Roxy-3D Which will be most of the time in an active print job, so I think it will have noticeable benefits.

@thinkyhead
Copy link
Member Author

Also moved calculation of dm and esteps ahead of the wait-for-block loop.

@thinkyhead thinkyhead changed the title buffer_line can calculate while it's waiting Optimize buffer_line by calculating before wait-for-free-block Oct 30, 2016
@thinkyhead thinkyhead merged commit 8a4c51f into MarlinFirmware:RCBugFix Oct 30, 2016
@thinkyhead thinkyhead deleted the rc_buffer_line_wait_later branch October 30, 2016 21:46
@Roxy-3D
Copy link
Member

Roxy-3D commented Oct 30, 2016

Which will be most of the time in an active print job, so I think it will have noticeable benefits.

I certainly believe this is worth doing! But I'm not sure it is going to be noticeable. Another way of looking at this is it increases our buffer depth from 16 to 17. When we have all 16 locations filled, it allows us to get through the crunching of one more.

But increasing the depth of the buffer by even one can stop some number of stutters!

@thinkyhead thinkyhead mentioned this pull request Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants