Strong Lagging / Only one CPU-Core used (Multicore support?)

Issue #249 duplicate
KASA created an issue

While zooming or moving around, FlatCam isnt smooth but just jumps to the new position after a short time. While doing this, only one CPU-Core is at 100%. The Core thats at 100% when moving or zooming seems to change. I have an i7-2630QM and I think this should be enough to run Flatcam. Im running FlatCam 8.5 on Ubuntu 18.4. This seems to be a fundamental Python limitation (no real multicore) so I guess there is no real way to fix this, right?

Comments (6)

  1. Juan Pablo Caram repo owner

    @JakobStaudt , it is not a Python limitation. It has to do with how the graphics are rendered.

    At this time we are using a plotting library (matplotlib) to render the graphics. It is not designed to handle zooming or panning, therefore, everytime the display changes, it recomputes everything.

    There is a branch that uses Open-GL for rendering (uses the GPU) that you can try: https://bitbucket.org/jpcgt/flatcam/branch/VisPyCanvas

    It it way faster for zooming and panning, but its graphics capabilities are quite limited (difficult to add new features), so it is unclear that we will continue to work on it.

    The most likely approach in the future is using QGraphics, part of the QT library (The GUI library in FlatCAM). It is really fast and fully featured.

    By the way, you can do multicore processing with Python. I do it all the time. Also, keep in mind that most Python libraries are not written in Python, but are compiled from C++ code, therefore are lightning fast!

  2. KASA reporter

    Thanks for the clarification, is there also a QT-rendering-branch? I would love to try it. BTW I think the problem was that the Gerber File I tested was very large. I downloaded a test file which was very detailed with many Structures, but now I imported a simple PCB and it reacts much faster.

  3. Juan Pablo Caram repo owner

    No, there is no QGraphics branch. I will probably start working on it by the end of 2018. Its a big project.

    Anyway, for most PCBs you will want to make with isolation routing, FlatCAM behaves quite well.

  4. Juan Pablo Caram repo owner

    @MariusStanciu , answering your question. Matplotlib is a highlevel library full of features. Like drawing curves of different styles, polygons with or without border, transparency, transformations (rotation, scaling), build in plot range (from what to what coordinates), build in grid, built in axes, support for multiple layers, text with different fonts, arrows, etc, etc, etc. VisPy on the other hand is very low level, and has almost nothing built-in. Furthermore, VisPy is a very young project (unstable, buggy, ...) compared to MatplotLib. Since FlatCAM uses so many different libraries, all of them need to be super stable and robust. If any problem shows up in any of the libraries, it breaks the whole program! That is the short version.

  5. Log in to comment