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

[INFRA] tiny speedup of building PDF by moving re.compile() outside of a loop #896

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

DimitriPapadopoulos
Copy link
Collaborator

5de7cfc / #774 changed:

matches = re.findall("({{.*?}})", contents)

into:
matches = re.findall(re.compile("({{.*?}})", re.DOTALL), contents)

If the intent was only to add DOTALL, I believe this would have been sufficient:

            matches = re.findall("({{.*?}})", contents, re.DOTALL)

If the intent was to use re.compile() for efficiency, then re.compile() must be moved outside the loop.

@DimitriPapadopoulos DimitriPapadopoulos changed the title [INFRA] move re.compile() out of the loop [INFRA] move re.compile() outside the loop Oct 12, 2021
@sappelhoff sappelhoff changed the title [INFRA] move re.compile() outside the loop [INFRA] tiny speedup of building PDF by moving re.compile() outside of a loop Oct 14, 2021
@sappelhoff sappelhoff merged commit 638ae5c into bids-standard:master Oct 14, 2021
@DimitriPapadopoulos DimitriPapadopoulos deleted the re.compile branch October 14, 2021 12:57
@effigies effigies added the exclude-from-changelog This item will not feature in the automatically generated changelog label Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exclude-from-changelog This item will not feature in the automatically generated changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants