-
Notifications
You must be signed in to change notification settings - Fork 644
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
Bug-analyzeCircuit() executes when simulation is disabled #967
Comments
could you send me an example of a large file that analyze circuit runs slowly on? |
I did some more testing and there seems to be more depth to this than I expected. anaylzeCircuit() takes 7800ms in LaggyCircuit1.circuitjs.txt, but when I load the subcircuit file it drops to 50ms. LaggyCircuit2.circuitjs.txt is just a long wire with a resistor and two labels on each end. In this file analyzeCircuit() takes around 16000ms, but when I put it into a subcircuit, it drops down to 0.2ms (see LaggyCircuit(2).circuitjs.txt). |
Yes, I tried a test circuit with a large number of wires chained together, and that was really slow because of the wires, but I wasn't sure how realistic that situation was. When you put it in a subcircuit the wires are removed so it's fast. |
How about LaggyCircuit1? Even, if it's expected to be so slow, it would help a lot, if it only analyzed the circuit when the simulation is running, so the circuit can be modified without waiting a few seconds every time something is moved. |
Yeah, it doesn't need to analyze the circuit when it's not running. So that would be an easy fix, I assume. LaggyCircuit1 is slow because of findUnconnectedNodes(). The main loop is slow and has to be run ~20 times. I'm not sure we need to start over from scratch every time we find an unconnected node, so I may be able to speed that up. Also, finding connections between two nodes looks really slow for subcircuit elements. Maybe that could be speeded up or at least cache the results. |
Circuitjs executes analyzeCircuit() after every change in the layout, which makes it impossible to work on larger projects, even, if the simulation times afterwards are ok.
The text was updated successfully, but these errors were encountered: