Commit 76f3693
authored
perf: skip validation for default timezones (#16129)
Payload's 48 hardcoded default timezones were being validated with `new
Intl.DateTimeFormat()` on every cold start. This is unnecessary since
they're known to be valid.
This change pre-computes a `Set` of default timezone values at module
load and skips validation for any timezone in that set.
Custom/user-provided timezones are still validated.
### Before/After
| Operation | Before | After |
|-----------|--------|-------|
| `sanitizeAdminConfig` | 9.18ms | 0.17ms |
| `validateTimezones` | 9.06ms | 0.03ms |1 parent a65e715 commit 76f3693
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
94 | 102 | | |
95 | 103 | | |
96 | 104 | | |
| |||
0 commit comments