Skip to content

Performance Tuning #76

@walles

Description

@walles

I think we're actually pretty good, from ./benchmark.py:

=== BENCHMARKING ===
154.2ms±1.6ms: /Users/johan/src/riff/.benchmark-binaries/riff-3.3.7
156.6ms±1.5ms: /Users/johan/src/riff/.benchmark-binaries/riff-3.3.8
154.4ms±1.0ms: /Users/johan/src/riff/.benchmark-binaries/riff-3.3.9
158.8ms±1.3ms: /Users/johan/src/riff/.benchmark-binaries/riff-3.3.10
238.3ms±1.5ms: /Users/johan/src/riff/.benchmark-binaries/riff-latest-commit-377bec3
237.0ms±1.5ms: /Users/johan/src/riff/.benchmark-binaries/riff-current
4.5ms±0.1ms: /bin/cat

But if we decide we need to get back to pre-hyperlink performance, here's an idea:

The slowdown is likely because we have to .clone() our AnsiStyle structs nowadays since they contain optional URLs which are not cloneable.

One way to get around this could be to have a URL number in AnsiStyle instead. 0 means no URL.

Any other number is an index into a global URLs vector.

Since numbers are cloneable, this should enable us to make AnsiStyle cloneable as well again.

Also, as a side effect, it might be possible to go back to some const functions, and maybe get rid of once_cell.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions