1 minute read

This article is the revised version. The archive of the pre-revision version is available at: /blog/heftia/heftia-part-1-2/

Part 1.1: Summary of Part 1 and an overview of heftia
Part 1.2: The performance of heftia
Part 1.3: Discussion on Type Safety in Haskell’s Effect Systems
Part 1.4: Future prospects of heftia

Performance

You can find all performance measurements for version 0.7 here. Below is a benchmark result of a typical real-world use case involving various effects and IO operations for aggregating file sizes. This benchmark was adapted from one originally used by effectful.

filesize-deep.svg

Smaller values indicate faster and better performance.

Performance discussions are complex1.

Compared to other approaches, it demonstrates consistently high speed relative to mtl, fused-effects, and polysemy. On the other hand, similar to those approaches, heftia still faces the challenge of decreasing performance as the effect stack becomes deeper when multiple effects are used simultaneously. In contrast, the effectful library, which uses the ReaderT IO approach, generally maintains consistent performance regardless of stack depth.

Performance always has room for improvement, whereas correctness improvements are often impossible due to foundational interface compatibility. This asymmetry is crucial and will be discussed later.

Make It Work, Make It Right, Make It Fast. Kent Beck

1.3 Make It Fast: The final phase revolves around optimizing the performance of the software, making it faster and more efficient. However, the need for speed should not compromise the correctness and maintainability achieved in the previous phases. It is crucial to identify specific areas that require performance improvements and make targeted optimizations, rather than pursuing speed at the expense of code quality. Make It Work, Make It Right, Make It Fast: The Evolution of Software Development


To be continued in Part 1.3…

  1. The causes for Freer’s perceived slowness are multifaceted. One significant reason, identified in the paper “Reflection without Remorse,” can be resolved by using a data structure called FTCQueue. In heftia, as in freer-simple, FTCQueue is used to achieve higher performance compared to other Freer implementations. 

Comments