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

Use String#end_with?("/") instead of regexp #3516

Merged
merged 4 commits into from Mar 1, 2015

Conversation

Projects
None yet
4 participants
@parkr
Member

parkr commented Feb 25, 2015

Turns out end_with? is about twice as fast.

~/jekyll/jekyll#master$ be ruby benchmark/end-with-vs-regexp
Calculating -------------------------------------
     no slash regexp    55.397k i/100ms
  no slash end_with?   114.876k i/100ms
-------------------------------------------------
     no slash regexp    906.003k (± 5.8%) i/s -      4.543M
  no slash end_with?      4.467M (± 8.9%) i/s -     22.171M
Calculating -------------------------------------
        slash regexp    60.033k i/100ms
     slash end_with?   112.577k i/100ms
-------------------------------------------------
        slash regexp      1.042M (± 6.2%) i/s -      5.223M
     slash end_with?      4.496M (± 9.5%) i/s -     22.290M

@parkr parkr added the Enhancement label Feb 25, 2015

@alfredxing

This comment has been minimized.

Show comment
Hide comment
@alfredxing

alfredxing Feb 25, 2015

Member

👍

Member

alfredxing commented Feb 25, 2015

👍

Show outdated Hide outdated Gemfile

@parkr parkr self-assigned this Mar 1, 2015

parkr added a commit that referenced this pull request Mar 1, 2015

Merge pull request #3516 from jekyll/end-with
Use String#end_with?("/") instead of regexp

@parkr parkr merged commit 50a4b28 into master Mar 1, 2015

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@parkr parkr deleted the end-with branch Mar 1, 2015

parkr added a commit that referenced this pull request Mar 1, 2015

@doktorbro

This comment has been minimized.

Show comment
Hide comment
@doktorbro

doktorbro Mar 4, 2015

Member

Great.

Member

doktorbro commented Mar 4, 2015

Great.

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.