-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve implementation of rstrip and lstrip #22496
Merged
Merged
Commits on Jun 23, 2017
-
change chomp! to chomp in readchomp
`chomp` uses `SubString` so `chomp!` is not needed to ensure that copying of big string is not performed.
Configuration menu - View commit details
-
Copy full SHA for 2de6acf - Browse repository at this point
Copy the full SHA 2de6acfView commit details -
`chomp!` was only used in `readchomp` and I propose to replace it with `chomp` there. As `chomp!` was not exported I understand that it can be removed without deprecation.
Configuration menu - View commit details
-
Copy full SHA for b4e347e - Browse repository at this point
Copy the full SHA b4e347eView commit details -
Make rstrip and lstrip use SubString
In this way copying of string is avoided, and in `strip` currently the string is actually copied twice. A basic benchmark is given below: ``` julia> using BenchmarkTools julia> s = " "^10*"x"^1000*" "^10; julia> @benchmark strip(s) # current definition BenchmarkTools.Trial: memory estimate: 2.13 KiB allocs estimate: 2 -------------- minimum time: 502.056 ns (0.00% GC) median time: 537.579 ns (0.00% GC) mean time: 631.383 ns (5.74% GC) maximum time: 6.003 μs (0.00% GC) -------------- samples: 10000 evals/sample: 197 julia> @benchmark strip(s) # with SubString definition BenchmarkTools.Trial: memory estimate: 64 bytes allocs estimate: 2 -------------- minimum time: 334.062 ns (0.00% GC) median time: 339.819 ns (0.00% GC) mean time: 362.150 ns (1.00% GC) maximum time: 8.236 μs (93.19% GC) -------------- samples: 10000 evals/sample: 243 ```
Configuration menu - View commit details
-
Copy full SHA for 3bc5953 - Browse repository at this point
Copy the full SHA 3bc5953View commit details
Commits on Jun 24, 2017
-
Configuration menu - View commit details
-
Copy full SHA for aee1c01 - Browse repository at this point
Copy the full SHA aee1c01View commit details -
Configuration menu - View commit details
-
Copy full SHA for 67b19fe - Browse repository at this point
Copy the full SHA 67b19feView commit details
Commits on Jun 25, 2017
-
Configuration menu - View commit details
-
Copy full SHA for ba34cb4 - Browse repository at this point
Copy the full SHA ba34cb4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 15eb9e2 - Browse repository at this point
Copy the full SHA 15eb9e2View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7de766 - Browse repository at this point
Copy the full SHA a7de766View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.