• Stan Hu's avatar
    Port browser checks to RE2 for performance · 91a432de
    Stan Hu authored
    The browser gem is quite inefficient for checking SameSite
    compatibility. If we rewrite the checks, we see much better performance:
    
    ```
    Warming up --------------------------------------
                no check    46.338k i/100ms
                   check    21.325k i/100ms
    Calculating -------------------------------------
                no check    446.012k (± 5.5%) i/s -      2.224M in   5.003135s
                   check    210.757k (± 2.8%) i/s -      1.066M in   5.062987s
    
    Comparison:
                no check:   446012.3 i/s
                   check:   210756.9 i/s - 2.12x  (± 0.00) slower
    ```
    91a432de
same_site_cookies.rb 4.4 KB