Skip to content

added note to re constructor regarding performance #13224

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

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/impure/re.nim
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ proc re*(s: string, flags = {reStudy}): Regex =
##
## Note that Nim's
## extended raw string literals support the syntax ``re"[abc]"`` as
## a short form for ``re(r"[abc]")``.
## a short form for ``re(r"[abc]")``. Also note that since this
## compiles the regular expression, which is expensive, you should
## avoid putting it directly in the arguments of the functions like
## the examples show below if you plan to use it a lot of times, as
Copy link
Contributor

Choose a reason for hiding this comment

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

show -> shown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if it says "in the examples" then yes, "shown" is appropriate. it is fine as it is now, but feel free to change it, i don't mind :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I misread, it's fine

## this will hurt performance immensely. (e.g. outside a loop, ...)
when defined(gcDestructors):
result = Regex()
else:
Expand Down