You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, the stdparam_state would look somthing like:
```
{
13 => { /\A(?-mix:[^.\/?]+)\Z/ => 24 },
14 => { /\A(?-mix:[^.\/?]+)\Z/ => 25 },
15 => { /\A(?-mix:[^.\/?]+)\Z/ => 26 },
16 => { /\A(?-mix:[^.\/?]+)\Z/ => 27 },
17 => { /\A(?-mix:[^.\/?]+)\Z/ => 28 },
18 => { /\A(?-mix:[^.\/?]+)\Z/ => 29 },
19 => { /\A(?-mix:[^.\/?]+)\Z/ => 30 },
20 => { /\A(?-mix:[^.\/?]+)\Z/ => 31 },
...
}
```
Every single value is a hash with DEFAULT_EXP_ANCHORED as the only key
and a state as the only value. Additionally, because these values are
hashes, the Transition Table used `#each` to iterate over them even
though the iteration ignores the key, DEFAULT_EXP_ANCHORED (since the
`match?` is cached outside the loop), and the hash will only ever
contain a single entry.
This commit refactors the `stdparam_state` to be a simple hash mapping
`from` to `to` values:
```
{
13 => 24,
14 => 25,
15 => 26,
16 => 27,
17 => 28,
18 => 29,
19 => 30,
20 => 31,
...
}
```
In a large application this can save thousands of retained hashes
(concretely, in jeremyevans/r10k's `rails_4_10.rb` benchmark this saves
21111 hashes).
0 commit comments