Open romshark opened 9 months ago
Alternatively, the error reporting can be changed to avoid needing Src
in the first place.
The downside would be slightly less convenient error messages:
error at index 6: illegal control character
instead of:
error at index 6 (0x02): illegal control character
But this can still be replicated by the API user if necessary.
The
string
type is smaller than a[]byte
and can be copied much faster. Copying structs <= 32 bytes on modern 64-bit systems is essentially free whereasError[[]byte]
is 40 bytes wide making jscan work faster withstring
than with[]byte
. This PR eliminates the overhead at the cost of backward compatibility improving performance by about 14%.unsafe
.Error
:Src
.Error
is no longer required to be type-parameterized.An alternative solution is presented in #25.
Benchmark results: