Ushering out strlcpy()
Ushering out strlcpy()
Posted Aug 26, 2022 16:59 UTC (Fri) by NYKevin (subscriber, #129325)In reply to: Ushering out strlcpy() by wtarreau
Parent article: Ushering out strlcpy()
Posted Aug 26, 2022 18:54 UTC (Fri)
by wtarreau (subscriber, #51152)
[Link] (4 responses)
Posted Aug 26, 2022 20:47 UTC (Fri)
by NYKevin (subscriber, #129325)
[Link] (3 responses)
> The only thing you'll miss then is the machine-specific optimizations that went into a number of C libraries for byte search, fill or move (which can be significant for strchr() or memset()).
strchr and memset are libc functions, so I interpreted "a number of C libraries" as meaning "libc, and possibly other libraries, but mostly libc." If libc has machine-specific optimizations, and Rust can emit libc calls into the LLVM IR (which can then be inlined if it is advantageous to do so), then what exactly is the problem? Most of the interesting libc functions have some sort of safe wrapper in the Rust stdlib, and the language also provides a full FFI for calling arbitrary C code, so I really don't see what disadvantage you're talking about here.
Posted Aug 26, 2022 21:05 UTC (Fri)
by wtarreau (subscriber, #51152)
[Link] (2 responses)
Posted Aug 26, 2022 22:00 UTC (Fri)
by NYKevin (subscriber, #129325)
[Link] (1 responses)
[1]: https://doc.rust-lang.org/std/primitive.str.html#method.find
Posted Aug 29, 2022 9:37 UTC (Mon)
by wtarreau (subscriber, #51152)
[Link]
Ushering out strlcpy()
Ushering out strlcpy()
Ushering out strlcpy()
Ushering out strlcpy()
Ushering out strlcpy()