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

Make neighbors for graphs faster by returning an iterator #824

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

epatters
Copy link
Member

@epatters epatters commented Jul 7, 2023

I guess this will technically be a breaking change but I'm pretty sure that my original implementation did return an iterator and it got changed somewhere along the way.

In the benchmarks on my local machine, we can see the "within a factor of 2 to 3" performance with Graphs.jl that we should expect. Previously, it was off by several orders of magnitude.

BenchmarkGroup:
        10-element BenchmarkTools.BenchmarkGroup:
          tags: []
          "Graph" => 3-element BenchmarkTools.BenchmarkGroup:
        	  tags: []
        	  "LightGraphs" => 4-element BenchmarkTools.BenchmarkGroup:
        		  tags: []
        		  "iter-neighbors" => Trial(5.085 μs)
        		  "iter-edges" => Trial(9.170 μs)
        		  "make-path" => Trial(1.482 ms)
        		  "has-edge" => Trial(28.376 μs)
        	  "Catlab" => 4-element BenchmarkTools.BenchmarkGroup:
        		  tags: []
        		  "iter-neighbors" => Trial(14.507 μs)
        		  "iter-edges" => Trial(3.625 ns)
        		  "make-path" => Trial(3.298 ms)
        		  "has-edge" => Trial(32.828 μs)
        	  "Catlab-vectorized" => 2-element BenchmarkTools.BenchmarkGroup:
        		  tags: []
        		  "iter-edges" => Trial(1.203 ms)
        		  "make-path" => Trial(7.161 ms)
          "SymmetricGraph" => 3-element BenchmarkTools.BenchmarkGroup:
        	  tags: []
        	  "LightGraphs" => 4-element BenchmarkTools.BenchmarkGroup:
        		  tags: []
        		  "iter-neighbors" => Trial(4.747 μs)
        		  "iter-edges" => Trial(27.143 μs)
        		  "make-path" => Trial(990.531 μs)
        		  "has-edge" => Trial(27.050 μs)
        	  "Catlab" => 4-element BenchmarkTools.BenchmarkGroup:
        		  tags: []
        		  "iter-neighbors" => Trial(14.172 μs)
        		  "iter-edges" => Trial(4.400 ns)
        		  "make-path" => Trial(131.336 ms)
        		  "has-edge" => Trial(34.737 μs)
        	  "Catlab-vectorized" => 2-element BenchmarkTools.BenchmarkGroup:
        		  tags: []
        		  "iter-edges" => Trial(2.383 ms)
        		  "make-path" => Trial(18.830 ms)

@epatters epatters merged commit f4b699d into AlgebraicJulia:main Jul 10, 2023
13 checks passed
@epatters epatters deleted the iter-neighbors-perf branch July 10, 2023 20:42
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.

1 participant