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

Add benchmarks for Span #646

Merged
merged 1 commit into from
Oct 8, 2022
Merged

Add benchmarks for Span #646

merged 1 commit into from
Oct 8, 2022

Conversation

5nord
Copy link
Member

@5nord 5nord commented Oct 8, 2022

This PR adds three benchmarks for the Span-method of the syntax nodes.

The syntax three does not store line information of every node. Instead we rely on a line-map and a binary search converting file offsets to source lines.

Position heavy tools (like formatter) could benefit from a line cache. The benchmarks in this commit may assist during optimization.

Three benchmarks (with still similar performance) have been added:

  • BenchmarkSpansRandomAccess accesses text spans in random order, acting as baseline for spans without cache.

  • BenchmarkSpansTreeInspect accesses text spans in tree traversal order. Tree traversal order means that the begin and end positions are in many cases in different lines, which makes it harder to implement an efficient cache.

  • BenchmarkSpansTokenList accesses text spans in linear order.

This commit adds three benchmarks for the Span-method of the
syntax nodes.

The syntax three does not store line information of every node. Instead
we rely on a line-map and a binary search converting file offsets to
source lines.

Position heavy tools (like formatter) could benefit from a line cache.
The benchmarks in this commit may assist during optimization.

Three benchmarks (with still similar performance) have been added:

* BenchmarkSpansRandomAccess accesses text spans in random order, acting as
  baseline for spans without cache.

* BenchmarkSpansTreeInspect accesses text spans in tree traversal order.
  Tree traversal order means that the begin and end positions are
  in many cases in different lines, which makes it harder to implement
  an efficient cache.

* BenchmarkSpansTokenList accesses text spans in linear order.
@5nord 5nord merged commit 43114d7 into nokia:master Oct 8, 2022
@5nord 5nord deleted the add-line-benchmarks branch October 8, 2022 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant