|
Head is the most-constructed object in the codebase -- 227k of them to stream
one bash -- and from_raw was paying for two things it did not need.
_as_int ended in a ternary whose arms were BOTH int(v, 16), so the
isinstance+startswith in front of them decided nothing and ran on every
address the client parses (55k times per 60 pages). Removed; the function is
now the isinstance it always was.
Head(...) was built by keyword, which makes the tuple match names against
fields; positional is the same object with none of that. Address conversion
is inlined for the same reason from_raw exists at all.
Together 30% off Head construction (2.27 -> 1.59ms per 2003 rows, 0.34us a
row), with output verified identical against the previous implementation over
both skeleton and full rows. isinstance was kept over the 5%-faster
"type(v) is int" because the two differ for bool and int subclasses, and that
is not a trade worth making for 5% of 12% of a page.
End to end this is ~2.5% of bash's boot (3117 -> 3065ms): Head construction
was ~12% of the client half, and the client half is ~54% of what is left.
Adds experiments/profile_client.py -- profile_remote.py's counterpart for the
half of a page load that happens outside the database process, which is where
the remaining time now is.
Full gate: 1050 passed.
|