-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Performance degradation from 1.11 to 2.0 #7400
Comments
Thanks for this report! This is a blast from the past. I suspect it is the change from Can you try changing the subgraph creation to |
The matching speed actually got back to 1.11's performance, though the whole algo is slower using If the graph is being generated dynamically in the same algorithm (based on certain factors from db), then separated into subgraphs and matched, is there a way to reach 1.11's performance as a whole? Would you happen to know other workarounds? 😅 Also, thanks for the response!
|
IMO it's difficult to get a real handle on performance differences when comparing across years worth of development. Python itself has changed quite a bit from 3.2 -> 3.10. You may see improvements if you're able to switch to 3.11. I don't think there's a whole lot that can be done to reproduce the same performance characteristics of nx v1.11 with the modern machinery. If graph copying is the bottleneck of your analysis pipeline, perhaps you can consider trying to vendor the subgraphing system (or performance-relevant bits) from nx v1.11. |
Maybe we should revisit the implementation and try using
|
Current Behavior
I have noticed a pretty big performance degradation between 1.11 and 2.0.
Had to upgrade recently and could not use 1.11 anymore.
In one of my benchmarking tools, I could see that 2.0 is ~10x slower than 1.11 when trying to do bipartite matching.
Expected Behavior
Not as much of a slowdown.
Steps to Reproduce
Made a benchmark script.
With an 11MB 'graph_adj' file.
graph_adj.txt
Now, the values are as follows:
For networkx 1.11, this is the cProfile output:
And for anything over 2.0 it's:
Environment
WSL2 venv
Python version: 3.10 (for Networkx >= 2.6), 3.8 (for Networkx <= 2.4)
NetworkX version: 1.11 -> 3.2.1
Additional context
While I know that networkx is not made for speed, I'm just bringing to attention if this degradation in performance is actually intended. I also visually see in SnakeViz when putting this cProfile output that there's more changes like "checking for connected graphs", etc.
Unfortunately also trying to convert this graph to scipy using
to_scipy_sparse_array
also takes almost the same as the matching, hence making the whole conversion useless most of the times.The text was updated successfully, but these errors were encountered: