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

Freeze string literals and mutable constants #128

Merged
merged 4 commits into from
Jan 31, 2019
Merged

Freeze string literals and mutable constants #128

merged 4 commits into from
Jan 31, 2019

Conversation

jage
Copy link
Contributor

@jage jage commented Jan 31, 2019

I did this with rubocop:

rubocop --only Style/FrozenStringLiteralComment,Style/MutableConstant --auto-correct

Opted to not add rubocop at this stage, wanted to limit the amount of
work here.

I did this with rubocop:

    rubocop --only Style/FrozenStringLiteralComment,Style/MutableConstant --auto-correct

Opted to not add rubocop at this stage, wanted to limit the amount of
work here.
spec/lib/twingly/url_spec.rb Outdated Show resolved Hide resolved
@walro
Copy link
Contributor

walro commented Jan 31, 2019

Performance benchmarks? 😉

@jage
Copy link
Contributor Author

jage commented Jan 31, 2019

Performance benchmarks? 😉

I'm guessing it's hardly noticeable compared to the Addressable/Public-suffix stuff going on under the hood, but if it would be cool to have two more rake tasks, one to measure speed and another to measure allocated objects. Currently I think we're only profiling method calls IIRC.

@jage
Copy link
Contributor Author

jage commented Jan 31, 2019

I think this should be extracted to a frozen constant as well, if I understand this correctly there will be a new Regex object on each normalize_blogspot-call currently.

host.sub(/\Awww\./i, "").sub(/#{domain.tld}\z/i, "com")

@walro
Copy link
Contributor

walro commented Jan 31, 2019

I'm guessing it's hardly noticeable compared to the Addressable/Public-suffix stuff going on under the hood, but if it would be cool to have two more rake tasks, one to measure speed and another to measure allocated objects. Currently I think we're only profiling method calls IIRC.

I wasn't that serious, but yeah good ideas! :)

Copy link
Contributor

@walro walro left a comment

Choose a reason for hiding this comment

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

LGTM

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