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 optimization for compute_bleu precision initialization #257

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ernlavr
Copy link

@ernlavr ernlavr commented Feb 22, 2024

Description: Added a one-line optimization for initialization of the precissions list in def compute_bleu function.

Motivation: I have to do a total of 7 billion computations so I was looking at possibilities for optimizing the computation routine. I find that this change is about x4 faster for the operation, consisting of about 12% of total improvement for the function. Added a screenshots of my timings. See the diff between precissions_old and precissions_optim. Numbers are averaged over 10k computations.

image

P.s. this change is also reflected in this StackOverflow post https://stackoverflow.com/questions/20816600/best-and-or-fastest-way-to-create-lists-in-python

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