Merged
Conversation
Contributor
Author
|
Some timings: using CSTParser, StaticLint, SymbolServer, BenchmarkTools
server = StaticLint.FileServer()
ssi = SymbolServerInstance("/your/depot/path", "/your/cache/path")
_, server.symbolserver = SymbolServer.getstore(ssi, "~/.julia/environments/v1.7/")
server.symbol_extends = SymbolServer.collect_extended_methods(server.symbolserver)
function setup(rootp, fp, server)
empty!(server.files)
root = StaticLint.loadfile(server, rootp)
StaticLint.semantic_pass(root)
f = StaticLint.getfile(server, fp)
root, f
end
begin
root, f = @btime setup(Base.find_source_file("Base.jl"), Base.find_source_file("abstractarray.jl"), server);
@btime (StaticLint.clear_meta.(CSTParser.EXPR[f.cst[32]]);StaticLint.semantic_pass(root))
@btime (StaticLint.clear_meta.(CSTParser.EXPR[f.cst[32]]);StaticLint.semantic_pass(root, CSTParser.EXPR[f.cst[32]]))
@btime StaticLint.semantic_pass(f)
end
# 723.366 ms (3663143 allocations: 229.04 MiB)
# 171.288 ms (253585 allocations: 15.83 MiB)
# 86.797 ms (81905 allocations: 4.32 MiB)
# 4.115 ms (5311 allocations: 395.45 KiB)So we get about a 2x speedup on handling edits. This can probably be sped up further if we feed in information on what has actually changed at the toplevel (i.e. with this approach we're still trying to resolve anything that hasn't got a reference - we could limit that by only trying to resolve symbols matching new names that have been added). |
Contributor
Author
|
Subject to julia-vscode/CSTParser.jl#224 being merged, and a new verison tagged, this should be good to go. |
davidanthoff
previously approved these changes
Jan 22, 2021
Member
davidanthoff
left a comment
There was a problem hiding this comment.
Don't understand enough to really review this, but superficially it all looks great :) So, I'd say we merge.
Does this depend on a new CSTParser version? Shouldn't some test fail in that case?
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.
Adds a new option for
semantic_passwhereby only 'target' expressions get the full treatment (i.e. build new scopes, add bindings etc) for the rest we only resolve references. The logic isn't fully worked out but the idea is that we'd only run everything on the toplevel scope and those parts of the tree (delayed scope - e.g. functions) that are new - for the rest we only need to ensure that any new bindings that have been added to the toplevel scope are resolved.