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 benchmark test for "go to definition" #35

Merged
merged 2 commits into from
Feb 28, 2022

Conversation

julienduchesne
Copy link
Member

I want to refactor this code a bit but it'll be nice to see if the new code is faster
This extracts the test cases and uses them for both testing and benchmarking

To benchmark the code:

  1. Run benchmark with the old code: go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > old.txt
  2. Modify the code
  3. Run benchmark again: go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > new.txt
  4. Compare files: benchstat old.txt new.txt

I want to refactor this code a bit but it'll be nice to see if the new code is faster
This extracts the test cases and uses them for both testing and benchmarking

To benchmark the code:
1. Run benchmark with the old code: `go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > old.txt`
2. Modify the code
3. Run benchmark again: `go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > new.txt`
4. Compare files: `benchstat old.txt new.txt`
name string
filename string
position protocol.Position
type definitionTestCase struct {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click on Hide whitespace when reviewing this file. There are no changes to the test cases

@julienduchesne julienduchesne marked this pull request as ready for review February 24, 2022 02:24
@julienduchesne julienduchesne merged commit 9641da0 into main Feb 28, 2022
@julienduchesne julienduchesne deleted the julienduchesne/add-benchmark branch February 28, 2022 01:16
julienduchesne added a commit that referenced this pull request Feb 28, 2022
* Add benchmark test for "go to definition"
I want to refactor this code a bit but it'll be nice to see if the new code is faster
This extracts the test cases and uses them for both testing and benchmarking

To benchmark the code:
1. Run benchmark with the old code: `go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > old.txt`
2. Modify the code
3. Run benchmark again: `go test ./... -bench "BenchmarkDefinition/test_goto_definition_for_var_myvar" -count=10 > new.txt`
4. Compare files: `benchstat old.txt new.txt`

* nolint
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.

None yet

1 participant