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

Simplify code and prevent infinite loop #71

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

julienduchesne
Copy link
Member

@julienduchesne julienduchesne commented Sep 8, 2022

There's a continue without a i++ there, this could possibly loop forever
I also removed some unnecessary stacks, should be much faster

There's a continue without a i++ there, this could possibly loop forever
@github-actions
Copy link

github-actions bot commented Sep 8, 2022

Benchstat (compared to main):

name                                                                    old time/op  new time/op  delta
Definition/test_goto_definition_for_var_myvar-2                         8.21µs ± 6%  5.69µs ± 1%  -30.73%  (p=0.008 n=5+5)
Definition/test_goto_definition_on_function_helper-2                    8.09µs ± 1%  5.82µs ± 0%  -28.04%  (p=0.016 n=5+4)
Definition/test_goto_inner_definition-2                                 8.12µs ± 3%  5.87µs ± 1%  -27.71%  (p=0.008 n=5+5)
Definition/test_goto_super_index-2                                      8.41µs ± 2%  6.02µs ± 1%  -28.43%  (p=0.008 n=5+5)
Definition/test_goto_super_nested-2                                     8.27µs ± 1%  6.01µs ± 1%  -27.35%  (p=0.008 n=5+5)
Definition/test_goto_self_object_field_function-2                       8.42µs ± 2%  6.16µs ± 0%  -26.80%  (p=0.008 n=5+5)
Definition/test_goto_super_object_field_local_defined_obj_'foo'-2       8.85µs ± 1%  6.43µs ± 0%  -27.36%  (p=0.008 n=5+5)
Definition/test_goto_super_object_field_local_defined_obj_'g'-2         9.22µs ± 2%  6.52µs ± 0%  -29.32%  (p=0.008 n=5+5)
Definition/test_goto_local_var_from_other_local_var-2                   7.16µs ± 2%  5.13µs ± 0%  -28.38%  (p=0.016 n=5+4)
Definition/test_goto_local_obj_field_from_'self.attr'_from_other_obj-2  10.8µs ± 2%   7.6µs ± 0%  -29.70%  (p=0.016 n=5+4)
Definition/test_goto_local_object_'obj'_via_obj_index_'obj.foo'-2       8.51µs ± 1%  6.05µs ± 1%  -28.94%  (p=0.008 n=5+5)
Definition/test_goto_imported_file-2                                    25.2µs ± 1%  16.1µs ± 1%  -36.12%  (p=0.008 n=5+5)
Definition/test_goto_imported_file_at_lhs_index-2                       9.18µs ± 3%  6.50µs ± 0%  -29.19%  (p=0.008 n=5+5)
Definition/test_goto_imported_file_at_rhs_index-2                       9.06µs ± 1%  6.49µs ± 1%  -28.42%  (p=0.008 n=5+5)
Definition/goto_import_index-2                                          8.22µs ± 2%  5.83µs ± 1%  -29.15%  (p=0.008 n=5+5)
Definition/goto_attribute_of_nested_import-2                            10.4µs ± 3%   7.4µs ± 0%  -29.22%  (p=0.008 n=5+5)
Definition/goto_dollar_attribute-2                                      8.93µs ± 2%  6.46µs ± 1%  -27.65%  (p=0.008 n=5+5)
Definition/goto_dollar_sub_attribute-2                                  9.83µs ± 1%  7.09µs ± 1%  -27.95%  (p=0.008 n=5+5)
Definition/goto_dollar_doesn't_follow_to_imports-2                      9.08µs ± 1%  6.48µs ± 2%  -28.69%  (p=0.008 n=5+5)
Definition/goto_attribute_of_nested_import_no_object_intermediary-2     9.49µs ± 3%  6.59µs ± 1%  -30.58%  (p=0.008 n=5+5)
Definition/goto_self_in_import_in_binary-2                              64.6µs ± 2%  40.2µs ± 2%  -37.74%  (p=0.008 n=5+5)
Definition/goto_self_attribute_from_local-2                             8.58µs ± 2%  6.15µs ± 0%  -28.31%  (p=0.008 n=5+5)
Definition/goto_function_parameter_from_inside_function-2               8.86µs ± 2%  6.26µs ± 1%  -29.36%  (p=0.008 n=5+5)
Definition/goto_local_func_param-2                                      9.31µs ± 2%  6.55µs ± 0%  -29.69%  (p=0.008 n=5+5)
Definition/goto_self_complex_scope_1-2                                  9.61µs ± 2%  6.76µs ± 0%  -29.63%  (p=0.008 n=5+5)
Definition/goto_self_complex_scope_2-2                                  10.4µs ± 2%   7.4µs ± 1%  -28.23%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_clobber_string-2                         156µs ± 1%    94µs ± 1%  -39.86%  (p=0.016 n=4+5)
Definition/goto_with_overrides:_clobber_nested_string-2                  164µs ± 3%    97µs ± 2%  -41.19%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_clobber_map-2                            156µs ± 2%    95µs ± 2%  -39.03%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_map_(multiple_definitions)-2             156µs ± 2%    98µs ± 4%  -37.11%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_nested_map_(multiple_definitions)-2      170µs ± 8%   108µs ± 7%  -36.36%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_string_carried_from_super-2              152µs ± 2%    93µs ± 2%  -38.74%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_nested_string_carried_from_super-2       159µs ± 3%    95µs ± 0%  -40.11%  (p=0.016 n=5+4)
Definition/goto_with_overrides:_string_carried_from_local-2              161µs ± 2%    96µs ± 1%  -40.24%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_string_carried_from_import-2             158µs ± 2%    97µs ± 3%  -38.74%  (p=0.008 n=5+5)
Definition/goto_with_overrides:_string_carried_from_second_import-2      157µs ± 2%    96µs ± 1%  -39.14%  (p=0.008 n=5+5)
Definition/goto_deeply_nested_imported_attribute-2                      14.4µs ± 2%  10.1µs ± 1%  -30.09%  (p=0.008 n=5+5)
Definition/goto_deeply_nested_imported_attribute_through_self-2         77.8µs ± 2%  45.7µs ± 1%  -41.30%  (p=0.008 n=5+5)
Definition/goto_computed_field_name_object_field-2                      9.06µs ± 2%  6.35µs ± 1%  -29.85%  (p=0.008 n=5+5)
Definition/goto_field_through_function-2                                9.74µs ± 5%  6.69µs ± 1%  -31.37%  (p=0.008 n=5+5)
Definition/goto_field_through_function-created_object-2                  205µs ± 1%   133µs ± 1%  -35.41%  (p=0.008 n=5+5)
Definition/goto_field_through_builder_pattern_attribute-2               15.0µs ± 1%  10.7µs ± 1%  -28.87%  (p=0.008 n=5+5)
Definition/goto_field_through_mixin_attribute-2                         12.1µs ± 2%   8.7µs ± 1%  -27.71%  (p=0.008 n=5+5)

@julienduchesne
Copy link
Member Author

julienduchesne commented Sep 8, 2022

Oh dang! 30% speed improvement across the board! nvm, just a difference in executor, will have to rethink the benchstat action, run both on the same executor

@julienduchesne julienduchesne marked this pull request as ready for review September 8, 2022 03:04
@julienduchesne julienduchesne merged commit 2961df8 into main Sep 8, 2022
@julienduchesne julienduchesne deleted the julienduchesne/prevent-infinite-loop branch September 8, 2022 11:06
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