This pr fixes some bugs in libc and adds an optimised memcpy() implementation.
Below is a benchmark comparing this implementation (‘intrin’) to glibc (‘glibc’).
I have also attached a C++ program using libbenchmark that can be used to reproduce the benchmark (compile and run w/ gcc -std=c++23 -O3 -march=native test.cc -lstdc++ -lbenchmark -lfmt -o test && ./test).
-----------------------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------------------
glibc (16 bytes) 0.207 ns 0.207 ns 1000000000
intrin (16 bytes) 0.204 ns 0.204 ns 1000000000
glibc (128 bytes) 1.62 ns 1.62 ns 429990997
intrin (128 bytes) 0.203 ns 0.203 ns 1000000000
glibc (1,024 bytes) 7.08 ns 7.08 ns 95637792
intrin (1,024 bytes) 0.616 ns 0.616 ns 1000000000
glibc (3,175 bytes) 30.2 ns 30.2 ns 23306688
intrin (3,175 bytes) 1.83 ns 1.83 ns 381575116
glibc (4,096 bytes) 33.0 ns 33.0 ns 21048745
intrin (4,096 bytes) 26.4 ns 26.4 ns 26498355
glibc (16,384 bytes) 114 ns 114 ns 6106968
intrin (16,384 bytes) 106 ns 106 ns 6605032
glibc (1,048,576 bytes) 17045 ns 17038 ns 41071
intrin (1,048,576 bytes) 15788 ns 15781 ns 44592
glibc (1,000,000,000 bytes) 58602936 ns 58570277 ns 12
intrin (1,000,000,000 bytes) 52938424 ns 52901710 ns 13
This pr fixes some bugs in libc and adds an optimised `memcpy()` implementation.
Below is a benchmark comparing this implementation (‘intrin’) to glibc (‘glibc’).
I have also attached a C++ program using libbenchmark that can be used to reproduce the benchmark (compile and run w/ `gcc -std=c++23 -O3 -march=native test.cc -lstdc++ -lbenchmark -lfmt -o test && ./test`).
```
-----------------------------------------------------------------------
Benchmark Time CPU Iterations
-----------------------------------------------------------------------
glibc (16 bytes) 0.207 ns 0.207 ns 1000000000
intrin (16 bytes) 0.204 ns 0.204 ns 1000000000
glibc (128 bytes) 1.62 ns 1.62 ns 429990997
intrin (128 bytes) 0.203 ns 0.203 ns 1000000000
glibc (1,024 bytes) 7.08 ns 7.08 ns 95637792
intrin (1,024 bytes) 0.616 ns 0.616 ns 1000000000
glibc (3,175 bytes) 30.2 ns 30.2 ns 23306688
intrin (3,175 bytes) 1.83 ns 1.83 ns 381575116
glibc (4,096 bytes) 33.0 ns 33.0 ns 21048745
intrin (4,096 bytes) 26.4 ns 26.4 ns 26498355
glibc (16,384 bytes) 114 ns 114 ns 6106968
intrin (16,384 bytes) 106 ns 106 ns 6605032
glibc (1,048,576 bytes) 17045 ns 17038 ns 41071
intrin (1,048,576 bytes) 15788 ns 15781 ns 44592
glibc (1,000,000,000 bytes) 58602936 ns 58570277 ns 12
intrin (1,000,000,000 bytes) 52938424 ns 52901710 ns 13
```