-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Memoize regexps for common character classes (#524)
This improves the performance of `Addressable::URI#encode` and `Addressable::URI#encode_component` by memoizing the default character class regexes instead of recompiling them on every call. This results in the following performance improvements: ### `Addressable::URI#encode_component` Addressable::URI#encode_component (old) 95.417k (± 1.4%) i/s - 484.347k in 5.077072s Addressable::URI#encode_component (new) 426.794k (± 1.6%) i/s - 2.134M in 5.001961s ### `Addressable::URI#encode` benchmark Addressable::URI#encode (old) 20.800k (± 1.2%) i/s - 105.213k in 5.058973s Addressable::URI#encode (new) 34.344k (± 2.3%) i/s - 174.794k in 5.092458s
- Loading branch information
Showing
1 changed file
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters