jackson-core icon indicating copy to clipboard operation
jackson-core copied to clipboard

Prefer bitwise OR over addition for UTF-8 multi-byte encoding

Open cowtowncoder opened this issue 1 year ago • 2 comments

(contributed by @xtonik)

cowtowncoder avatar Feb 15 '24 00:02 cowtowncoder

@xtonik Are bitwise logical operators faster than basic arithmetic (add, sub)? Back in the days costs were similar if not identical, but I haven't really been following on how CPU instruction costs fare these days.

So, basically, I assume this is expected to improve performance, but not sure how to verify: could build a micro-benchmark I guess but was guessing you have more information onthis.

cowtowncoder avatar Feb 15 '24 00:02 cowtowncoder

@xtonik Forgot to follow up on this -- do you have something (tests, articles) to support the idea that this helps speed up processing?

cowtowncoder avatar Mar 28 '24 18:03 cowtowncoder