Commit 6378558
committed
⚡️ Memoize salted_password for AUTHENTICATE SCRAM
`SASL::ScramAlgorithm` and `SASL::ScramAuthenticator` use
`salted_password` _at least_ twice: once to compute `client_key` and
once to compute `server_key`. It is actually used more than that, since
`client_key` and `server_key` are also used multiple times each.
Computing `salted_password` is _intentionally_ computationally
expensive, so it should be cached.
Although `client_key` and `server_key` are far less computationally
expensive, they _are_ used multiple times, so they are memoized too.
Ultimately, we _could_ memoize most of the methods in `ScramAlgorithm`,
but I've decided to keep it simple by only memoizing these three.1 parent 07b6dd3 commit 6378558
1 file changed
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
155 | 158 | | |
156 | 159 | | |
157 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
158 | 170 | | |
159 | 171 | | |
160 | 172 | | |
| |||
194 | 206 | | |
195 | 207 | | |
196 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
197 | 216 | | |
198 | 217 | | |
199 | 218 | | |
| |||
0 commit comments