Skip to content

Move enzymeMap to package level, compile regular expressions only once - #273

Merged
TimothyStiles merged 1 commit into
bebop:mainfrom
matiasinsaurralde:clone
Oct 17, 2022
Merged

Move enzymeMap to package level, compile regular expressions only once#273
TimothyStiles merged 1 commit into
bebop:mainfrom
matiasinsaurralde:clone

Conversation

@matiasinsaurralde

Copy link
Copy Markdown
Contributor

I think that this might be useful and perform better if you're calling getBaseRestrictionEnzymes multiple times in the same function. Before this change, getBaseRestrictionEnzymes would compile the same regular expressions over and over.

@gitpod-io

gitpod-io Bot commented Oct 15, 2022

Copy link
Copy Markdown

@TimothyStiles

Copy link
Copy Markdown
Collaborator

Thanks for the PR @matiasinsaurralde! It looks like @Koeng101 defined enzymeMap as a function so that it'd behave as a constant but maybe it's no longer necessary that it does.

https://qvault.io/2019/10/21/golang-constant-maps-slices/

Do you remember the reasoning behind this @Koeng101?

@Koeng101 Koeng101 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Koeng101

Copy link
Copy Markdown
Contributor

The reason was I just wanted an easy way to see default enzymes. However, the reasoning to put it behind a function makes sense to me.

@TimothyStiles
TimothyStiles merged commit ab57dd0 into bebop:main Oct 17, 2022
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.

3 participants