What is the advantages of ReducingState over ValueState and vice versa ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

What is the advantages of ReducingState over ValueState and vice versa ?

Kien Truong
Hi all,

Since both ReducingState and ValueState store a single value, there are many use cases where both can be used.
When should we use one instead of the other ?

Best regards,
Kien
Reply | Threaded
Open this post in threaded view
|

Re: What is the advantages of ReducingState over ValueState and vice versa ?

Stephan Ewen
Hi!

Currently, there will not be much difference in how the execution behaves (assuming you manually read from the value state, aggregate, and write back). Think of the ReducingState as syntactic sugar.

However, the ReducingState has the potential for performance optimizations (deferred reducing if values are currently not in memory). That is not really exploited at the moment, though.

On the other hand, the value state has the advantage that it is a bit more flexible, and you can change the logic easier when upgrading the program.

Greetings,
Stephan




On Thu, Dec 29, 2016 at 10:39 AM, Truong Duc Kien <[hidden email]> wrote:
Hi all,

Since both ReducingState and ValueState store a single value, there are many use cases where both can be used.
When should we use one instead of the other ?

Best regards,
Kien