ibireme / yyjson

The fastest JSON library in C
https://ibireme.github.io/yyjson/doc/doxygen/html/
MIT License
3.04k stars 262 forks source link

memcpy 2 4 maybe slower than "repeat2_incr" #98

Closed wj5449 closed 1 year ago

wj5449 commented 1 year ago

Please use English to communicate so that people from other countries can understand it. i heared about memcpy when copy little string is slower than = because of the memcpy use call instrustion. on my computer memcpy 2 is slower than "repeat2_incr" memcpytest.txt

wj5449 commented 1 year ago

i don't know about what value of strlength choose which function is faster

ibireme commented 1 year ago

The compiler will do the optimization for you, and usually they produce the exact same instructions, see: https://godbolt.org/z/4nEr4bKbT