mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-01 05:14:58 +00:00
Previously, if we copied the last byte for a length of 100, we'd recalculate the read span 100 times and memmove one byte 100 times, which resulted in a lot of overhead. Now, if we know that we have two consecutive copies of the data, we just extend the distance to cover both copies, which halves the number of times that we recalculate the span and actually call memmove. This takes the running time of the attached benchmark case from 150ms down to 15ms.
6.5 KiB
6.5 KiB