Commit 4a5ca44
committed
perf: reorder isinstance chain to check BoundStatement first in _create_response_future
For prepared-statement workloads (the perf-critical case), BoundStatement
is the most common query type reaching _create_response_future. Checking
it before SimpleStatement saves one wasted isinstance() call per dispatch.
Benchmark (80% BoundStatement, 15% SimpleStatement, 5% other):
SimpleStatement first: 32.8 ns/dispatch
BoundStatement first: 23.2 ns/dispatch
Speedup: ~1.4-1.7x (~10-15 ns/dispatch saved)1 parent 59cec4c commit 4a5ca44
1 file changed
Lines changed: 11 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2984 | 2984 | | |
2985 | 2985 | | |
2986 | 2986 | | |
2987 | | - | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
2988 | 2998 | | |
2989 | 2999 | | |
2990 | 3000 | | |
| |||
2993 | 3003 | | |
2994 | 3004 | | |
2995 | 3005 | | |
2996 | | - | |
2997 | | - | |
2998 | | - | |
2999 | | - | |
3000 | | - | |
3001 | | - | |
3002 | | - | |
3003 | | - | |
3004 | 3006 | | |
3005 | 3007 | | |
3006 | 3008 | | |
| |||
0 commit comments