Repository navigation
perf: Return a single-index result of [.igraph.vs without c() - #2940
Open
schochastics wants to merge 1 commit into
Open
schochastics wants to merge 1 commit into
schochastics wants to merge 1 commit into
Conversation
With one index argument, `[.igraph.vs` passed its result through `c()`, which re-parses the sequence and mints a fresh weak reference to the graph. The result is now returned as is, as `[.igraph.es` already does, so it keeps sharing the input's reference. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
|
This is how benchmark results would change (along with a 95% confidence interval in relative change) if 72ded03 is merged into perf/vs-lazy-names-bench:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split 2 of 3 from #2696, per #2696 (comment).
Stack: #2939 -> this -> #2696.
Change
With a single index argument,
[.igraph.vspassed its one result throughc().c.igraph.vs()re-parses the sequence and wraps it again, which mints a fresh weak reference to the graph.The result is now returned as is, as
[.igraph.esalready does.The returned sequence has the same values, names, class and graph ID as before.
The only difference is that it now shares the input's weak reference instead of holding a new one to the same graph, in line with #2886.
Benchmarks
Local, release builds of
mainvs. this branch, median of 4 interleaved fresh processes (bench::mark()), touchstone setups:mainV(g)[color == "red"](vs_attr_filter)V(g)[pick](vs_by_name)vs_by_nameis unchanged because indexing with a plain variable already returns early, beforec().Verification
envreference and give the expected vertices; a two-argument index still concatenates.🤖 Generated with Claude Code