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

perf: Use itemgetter instead of lambda #6671

Merged
merged 1 commit into from Apr 18, 2024

Conversation

VIKTORVAV99
Copy link
Member

Description

Itemgetter is slightly faster than using a lambda so we should probably use that.

From a stack overflow thread:

List size lambda itemgetter
100 8.19 5.09
1000 81.4 47
10000 855 498
100000 14600 10100
1000000 172000 131000
Source: https://stackoverflow.com/questions/17243620/operator-itemgetter-or-lambda

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier@2 --write . and poetry run format in the top level directory to format my changes.

@github-actions github-actions bot added the python Pull requests that update Python code label Apr 17, 2024
@VIKTORVAV99 VIKTORVAV99 merged commit 04df31e into master Apr 18, 2024
19 of 20 checks passed
@VIKTORVAV99 VIKTORVAV99 deleted the vik/swith_lambda_with_itemgetter branch April 18, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants