Epoch Refinements and Performance Considerations
Today, I focused on making improvements to Epoch, particularly concerning how events are persisted and how the aggregate state is managed.
Epoch Improvements
I've implemented changes in Epoch that primarily affect the order in which the aggregate persists events. Additionally, the aggregate now pre-hydrates its state if it wasn't already present. This means we could potentially wipe the entire table, and the aggregate would be capable of reconstructing its state from the event stream before applying any new events.
Performance Considerations
One aspect that has become painfully obvious is that the performance of this library is not optimal. I'm currently using clone
extensively, and there are many static instances scattered throughout the codebase. These areas will require significant work at some point to improve overall performance.
Despite the performance issues, from a usability perspective, Epoch is starting to become quite useful.
Event Versioning
I've been contemplating whether to continue forcing users to manually set the event version. I've decided that it would be more intuitive and robust for the aggregate itself to set the event version, deriving it from the previous version of the state. This approach simplifies the API for users and ensures consistency.