Neat work and comments from Glaze designer #26
Replies: 1 comment 1 reply
-
My bad I never saw this when you posted it. I will update the response once I've gotten to it. What I mean by resaturating the CPU registers instead of only operating on 64-bytes worth of string data at a time refers to the phase-1 parsing done within Simdjson, where they use SIMD instructions to first collect the structural indices of the json data. Instead of repacking the data into SIMD registers after the first part of phase-1, they begin to operate using 64-bit registers on the string data. As far as I could tell, repacking the data into SIMD registers seems to offer a roughly 30% increase in performance for phase-1 of parsing. Additionally, I've since improved on the unsafe bool parsing methods you mentioned here. Cheers! |
Beta Was this translation helpful? Give feedback.
-
Hey, I came across your library and it's neat what you've done with Glaze and simdjson. That's quite a bit of work to rewrite it all.
I'm always interested in improving the performance in Glaze, and it looks like you might have found some improvements using SIMD. However, it's hard for me to tell exactly where the performance improvements are coming from, especially because some things in Jsonifier for writing or parsing are unsafe. And, on platforms where SIMD isn't supported, like Arm Macs, Glaze is significantly faster.
Note that your parsing of booleans is not JSON compliant because you check the first character for
t
orf
, but if that passes you only compare againsttrue
, so if the input isfluge
, it will read as false even though this is invalid JSON.I'm not sure if you're benchmarking with MSVC, but it's worth noting that MSVC is not nearly as good a compiler as Clang and GCC right now and Glaze is significantly faster (sometimes twice as fast) with GCC than MSVC on the same platform.
Could you share what compiler you're using for your benchmarks?
I'm curious what you mean exactly by resaturating the CPU registers for better SIMD performance? Care to elaborate?
Neat work! I hope to learn from you.
Sincerely,
Stephen
Beta Was this translation helpful? Give feedback.
All reactions