Commit 725972b
authored
perf(client): remove redundant default instanceof fallback in ORPCError (#1764)
`ORPCError`'s custom `Symbol.hasInstance` no longer falls back to the
default `instanceof` check after the cross-context constructor walk. The
walk already subsumes it: any instance the default check would match
carries this graph's `ORPCError` constructor in its prototype chain, and
that constructor is always registered in the shared WeakSet — so the
fallback could never change the result.
### Performance
- `instanceof` misses (e.g. `e instanceof ORPCError` on a plain `Error`
in catch paths) are ~20% faster: 2.35M → 2.87M ops/sec with a single
dependency graph, 2.01M → 2.41M with multiple graphs.
- Hit paths and cross-context matching behave exactly as before.
### Testing
- New assertions cover the case the removed fallback used to protect:
same-graph and extended instances still match while multiple dependency
graphs are registered.
- Client, contract, and server suites pass (970 tests); lint and
`type:check` clean.1 parent 4b86526 commit 725972b
2 files changed
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
105 | 116 | | |
106 | 117 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | | - | |
| 134 | + | |
136 | 135 | | |
137 | 136 | | |
138 | 137 | | |
| |||
0 commit comments