
10 Jul
2017
10 Jul
'17
4:57 p.m.
Vinnie Falco wrote:
The utf-8 validation of text websocket message payloads is a critical bottleneck.
I thought I'd have a look at that. Your code has a fast-path that attempts to check 8 bytes at a time by masking with 0x8080808080808080. I agree that that is probably a useful optimisation which a compiler is unlikely to apply by itself. Your implementation ( https://github.com/vinniefalco/Beast/blob/6f88f0182d461e9cabe55032f966c9ca4f... ) does this: if((*reinterpret_cast<std::size_t const*>(in) & mask) != 0) So you're reinterpret_casting a char* to a size_t* and then dereferencing it. Isn't that undefined behaviour? Regards, Phil.