[ 
https://issues.apache.org/jira/browse/SPARK-57760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated SPARK-57760:
-----------------------------------
    Labels: pull-request-available  (was: )

> Optimize StatefulProcessorApiClient._serialize_to_bytes
> -------------------------------------------------------
>
>                 Key: SPARK-57760
>                 URL: https://issues.apache.org/jira/browse/SPARK-57760
>             Project: Spark
>          Issue Type: Improvement
>          Components: Structured Streaming
>    Affects Versions: 4.2.0
>            Reporter: Sagar Mittal
>            Priority: Trivial
>              Labels: pull-request-available
>
> In an internal benchmark, we have found `_serialize_to_bytes` is a 
> performance bottleneck. [Here is a microbenchmark for this 
> function|https://gist.github.com/funrollloops/62bf5fae1654910b63a4539e1181db91].
> I identified two optimizations to improve performance:
> 1. Use PickleSerializer() instead of the default CPickleSerializer
>    (CloudPickleSerializer). The stateful processor path does not deal with
>    code objects so the lighter serializer is sufficient.
> 2. Micro-optimize state value normalization: add a fast-path for Python
>    primitives, prefer `map` over generator comprehensions, and hoist the
>    numpy import and helper function definition to module level so they are
>    executed once rather than per call.
> Together these changes improve transform-with-state throughput on a simple
> rolling-window benchmark by around ~10%.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to