kageurufu / preprocess_cancellation

Klipper Exclude Object Preprocessor for multiple slicers
GNU General Public License v3.0
152 stars 25 forks source link

Hull building is very slow on embedded systems #16

Open Jookia opened 1 year ago

Jookia commented 1 year ago

Moonraker imports this package for preprocessing prints on embedded Linux boards like the Pi Zero. For the most part this is a great feature, but on large prints it's very very slow.

I did some profiling and the issue comes from the time spent parsing each G-code step to build a hull, even if the hull is just going to be a bounding box without shapely installed. Disabling this feature manages to cut around 100 seconds off the preprocessing time.

While having people do preprocessing in their slicer would be much better, it seems like people rely on this feature now.

Maybe a compromise would be to disable this hull building by default and falling back to any bounding box a slicer includes. I know that PrusaSlicer and friends provide this information.

kozross commented 1 year ago

FWIW, Mainsail's own docs essentially suggest an on-board configuration. While in theory Moonraker could reside somewhere else, in practice, Klipper and Moonraker are almost always co-resident, and while an off-board option is mentioned, it's done only in passing.

This setup can make for intolerably slow times for double-digit MiB G-code on weaker boards. Even more powerful ones like the RPi 4b can choke once we hit triple digit MiB. If you have some of the more exotic slicer features (like avoiding perimeter crossing, or PrusaSlicer's new curl avoidance) or print detailed models (such as miniatures, which I do), those numbers are very easy to hit.