FasterXML / jackson-core

Core part of Jackson that defines Streaming API as well as basic shared abstractions
Apache License 2.0
2.27k stars 795 forks source link

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

Closed cowtowncoder closed 5 months ago

cowtowncoder commented 8 months ago

(contributed by @xtonik)

cowtowncoder commented 8 months ago

@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 commented 7 months ago

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