Skip to content

Experiment with text-builder-linear for increased performance #69

@RyanGlScott

Description

@RyanGlScott

One of text-show's reasons for existence is to provide the same functionality as the Show, but faster. To this end, text-show's API is primarily based on Data.Text.Lazy.Builder, which makes it cheap to repeatedly append strings in the style of the Show class. While this can be fast, it's possible that it could be even faster, as the benchmarks in the text-builder-linear library indicate. text-builder-linear also offers a builder-style API, but it uses a mutable buffer under the hood for increased performance. We should experiment to see if using text-builder-linear can make text-show even faster.

It is worth noting that the builder-style API in text-builder-linear is not even the fastest way to use the library, as the library also offers an API based on directly mutating the underlying buffer. On the other hand, this API is pretty different from the style of code that text-show is currently using, so it would be a lot more work to port everything over to that API. Before we consider this approach, it would be worth porting the library over to using the builder API first (a much smaller lift) to see if the performance gains that I am envisioning will actually happen in practice.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions