comphead commented on issue #6485: URL: https://github.com/apache/datafusion-comet/issues/6485#issuecomment-6689409127
End-to-end numbers for fusion. A Spark-level benchmark ran each expression on Spark, on Comet, on Comet with the PoC kernels swapped in by the native planner, and on Comet with the whole tree in the JVM codegen dispatcher. Inputs were top-level columns, a struct, and a struct of structs, and every arm's rows were checked against Spark. M5 Max, Spark 4.1, one task, 1M rows: - Without fusion, Comet is 2 to 3x faster than Spark on these expressions, and 1.2 to 1.7x on a 32-term weighted sum. - The fused kernels cut the projection's own time 1.6 to 2.6x. Expressions are only 4 to 16% of Comet's wall time, so wall time drops 0 to 5% (`a * (1 - b) * (1 + c) + d`: 23.7 → 23.6 ms). At 128K rows and below, the difference is noise. - `CaseWhenExpr` already evaluates branches that cannot fail over the whole batch, so over columns a fused `CASE` is 1.6x faster than main at the expression level, not 11x. - Over struct fields, `CASE` and `AND` took the lazy path because `GetStructField` was missing from the infallible check. #7538 fixes that without codegen. `CASE` goes 22.4 → 16.4 ms, as fast as the fused kernel (16.9 ms), and a filter then project 35.3 → 18.0 ms. - The PoC's `CASE` kernels and its vectorized select pick each row's value with a branch, so they are fast only while the same batch repeats. Rotating over 64 batches, `case_1_branch` goes from 5.9 to 21.2 µs per 8192 rows and the select from 8.3 to 22.1 µs. A branch-free kernel stays at 4.0 µs. - The JVM dispatcher is 3 to 8x slower than native unfused evaluation at the expression level, and up to 24x on wide struct trees, which it splits into many kernels. At 0.6 to 1.8 ns saved per row, a 0.1 s `rustc` compile pays off after 55M to 170M rows, so runtime compilation needs kernels cached across queries, or kernels generated at build time. -- 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]
