Skip to content
  • Nobuyoshi Nakada's avatar
    05229cef
    Improve `String#slice!` performance · 05229cef
    Nobuyoshi Nakada authored
    Instead of searching twice to extract and to delete, extract and
    delete the found position at the first search.
    
    This makes faster nearly twice, for regexps and strings.
    
    |              |compare-ruby|built-ruby|
    |:-------------|-----------:|---------:|
    |regexp-short  |      2.143M|    3.918M|
    |regexp-long   |    105.162k|  205.410k|
    |string-short  |      3.789M|    7.964M|
    |string-long   |      1.301M|    2.457M|
    05229cef
    Improve `String#slice!` performance
    Nobuyoshi Nakada authored
    Instead of searching twice to extract and to delete, extract and
    delete the found position at the first search.
    
    This makes faster nearly twice, for regexps and strings.
    
    |              |compare-ruby|built-ruby|
    |:-------------|-----------:|---------:|
    |regexp-short  |      2.143M|    3.918M|
    |regexp-long   |    105.162k|  205.410k|
    |string-short  |      3.789M|    7.964M|
    |string-long   |      1.301M|    2.457M|
Loading