radmirnovii commented on PR #24588:
URL: https://github.com/apache/datafusion/pull/24588#issuecomment-5384374587

   Per-function numbers behind "a flat ~0.4–0.8 µs per cold batch": the five
   functions with hand-written arms, each by its own arm and by the mechanism,
   512 distinct values of 29 characters over 8192 rows. All four columns come
   from one run pinned to one core, with a counter in that run confirming the
   kernel saw 512 values on every cold pass — and that the arm's cold and warm
   columns agree, as they must for a path that cannot remember anything.
   
   | per batch | own arm, cold | mechanism, cold | own arm, warm | mechanism, 
warm |
   |---|---:|---:|---:|---:|
   | initcap | 49.5 µs | 50.3 µs | 49.5 µs | 0.72 µs |
   | reverse | 16.7 µs | 17.6 µs | 17.2 µs | 0.73 µs |
   | lower | 2.26 µs | 2.84 µs | 2.04 µs | 0.73 µs |
   | ascii | 1.68 µs | 2.32 µs | 1.56 µs | 0.73 µs |
   | character_length | 1.71 µs | 2.31 µs | 1.75 µs | 0.78 µs |
   
   An arm is nearly free where it exists — it already holds the dictionary, so
   peeling it is a downcast and a rewrap, about 0.2–0.4 µs over the kernel 
alone.
   The mechanism reaches the same values through a memo lookup and a tier
   decision: a flat 0.6–0.9 µs per batch whatever the function, invisible for
   `initcap`/`reverse` (2–5%), a quarter to a third of the call for the cheap
   three — which is why those are not adopters here. What no arm can do is the
   warm column: a remembered dictionary costs ~0.75 µs per batch (a read lock, a
   pointer comparison and an `Arc` clone) because nothing is computed.
   
   One measurement note, since it cost this table a rewrite: criterion calls the
   benchmark routine afresh per sample, so a batch cursor declared inside it
   restarts every sample and stops walking the batches in a clean cycle — the
   memo then serves a third of the "cold" passes. The benchmark keeps its cursor
   outside the routine and counts the values handed to the kernel in the same
   run, so cold means cold.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to