Add FrozenVector to wrap neighbors#317
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #317 +/- ##
==========================================
- Coverage 97.32% 97.28% -0.04%
==========================================
Files 125 126 +1
Lines 7652 7662 +10
==========================================
+ Hits 7447 7454 +7
- Misses 205 208 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
We could wait until #315 is merged to have a proper benchmarking pipeline? |
That one has been merged now. |
|
It has been merged to a branch of the main repo ( Besides performance issues, I am personally opposed to this change, because the additional wrapper might be confusing for users (what is this |
Right, I had just looked at the
Nowhere do we guarantee that we run an And And I don't think performance should be affected seriously. |
|
Futhermore, if someone is actually confused what a |
|
Okay, I'm convinced that the benefits outweigh the costs on the correctness side. Can you maybe run some benchmarks locally, say Dijkstra on a large enough graph, to see if there is a big performance hit from creating the wrappers every time? Maybe even |
|
I will probably merge to master before the community call. After you can use that for benchmarks and talk further. |
|
Awesome, thank you so much! Don't hesitate to ask for a review beforehand though, to follow ColPrac |
8286e57 to
43b3ad0
Compare
|
this needs a reformatting, but otherwise seems good to go |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Given Guillaume's comment, I will wait for the cleaned up benchmark runner before I merge this (see #490 ) |
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
|
None of the benchmarks show slowdown (not that the benchmarks are super thorough). I will merge this after the tests pass, given that the review from a few years ago seems to have been positive, even if somewhat muted. On skimming it quickly today, I also do not see issues with this approach, and it seems like a good protection against footguns. |
|
two doctests fail in an expected fashion, will submit a patch |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Julia 1.13 changed how empty AbstractVector subtypes are displayed.
Previously (<=1.12), an empty FrozenVector printed as:
0-element Graphs.FrozenVector{Int64}
In Julia 1.13+, it prints as:
Int64[]
This broke the doctests for `neighbors` and `ReverseView` that show
empty FrozenVector output. The fix adds a local doctest filter to
each affected jldoctest block that normalizes both representations
before comparison.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
563bd7f to
b0372cb
Compare
This PR makes the output of
neighbors,inneighborsandoutneighborsimmutable by wrapping the returnedVectorin an immutable wrapper calledFrozenVector.I noticed that the generated machine code for
Base.getindexis slightly different (one additional instruction) withFrozenVectorcompared to the previously usedVector- this does probably not have a significant performance impact, but I should run some benchmarks.See also this issue: #316