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

refactor: remove ActiveSupport dependency #39

Merged
merged 5 commits into from
Nov 4, 2023

Conversation

matteoredz
Copy link
Owner

@matteoredz matteoredz commented Oct 20, 2023

This PR aims at removing it by replacing AS methods with plain Ruby ones.

ActiveSupport#parameterize vs I18n.transliterate

Warming up --------------------------------------
slugged with I18n transliterate
                        15.744k i/100ms
slugged with ActiveSupport parameterize
                        14.699k i/100ms
Calculating -------------------------------------
slugged with I18n transliterate
                        157.087k (± 0.9%) i/s -    787.200k in   5.011649s
slugged with ActiveSupport parameterize
                        146.142k (± 1.0%) i/s -    734.950k in   5.029510s

Comparison:
slugged with I18n transliterate:   157087.1 i/s
slugged with ActiveSupport parameterize:   146142.0 i/s - 1.07x  slower

ActiveSupport#parameterize vs custom Transliterator

Warming up --------------------------------------
slugged with a custom Transliterator
                        16.636k i/100ms
slugged with ActiveSupport parameterize
                        14.851k i/100ms
Calculating -------------------------------------
slugged with a custom Transliterator
                        166.378k (± 0.3%) i/s -    848.436k in   5.099480s
slugged with ActiveSupport parameterize
                        148.417k (± 0.4%) i/s -    742.550k in   5.003193s

Comparison:
slugged with a custom Transliterator:   166378.0 i/s
slugged with ActiveSupport parameterize:   148417.2 i/s - 1.12x  slower

To Do

  • Check if replicating just the HashTransliterator could be enough to avoid including I18n as dependency

@matteoredz matteoredz added the enhancement New feature or request label Oct 20, 2023
@matteoredz matteoredz self-assigned this Oct 20, 2023
@matteoredz matteoredz linked an issue Oct 20, 2023 that may be closed by this pull request
@matteoredz matteoredz force-pushed the 38-remove-activesupport-dependency branch 4 times, most recently from fef19fa to 2df1e72 Compare October 23, 2023 20:04
@matteoredz matteoredz force-pushed the 38-remove-activesupport-dependency branch from 2df1e72 to 8009ef0 Compare October 26, 2023 07:27
@matteoredz matteoredz marked this pull request as ready for review November 4, 2023 11:41
@matteoredz matteoredz merged commit 9302954 into main Nov 4, 2023
9 checks passed
@matteoredz matteoredz deleted the 38-remove-activesupport-dependency branch November 4, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove ActiveSupport dependency
1 participant