Skip to content

Commit a6bcc0a

Browse files
committed
Gardening: Polish enum lookup in MemcacheProtocol
Motivation ---------- Simplify enum definitions and lookups. Modifications ------------- Use IntMap for looking up enum values by their code. Change the enum constructors to take `int` so we can cast (to byte or short) in just one place, instead of having to repeat the cast in every enum value definition. Performance Note ---------------- These enum parsing methods are currently used only by diagnostic code, so performance isn't absolutely critical. However, after a bit of JIT action, IntMap is measurably faster than the switches it replaces here. Change-Id: I83ad68b42435aa5a3ae24765b2745ae6c9a2c1bf Reviewed-on: https://review.couchbase.org/c/couchbase-jvm-clients/+/206121 Tested-by: Build Bot <[email protected]> Reviewed-by: Graham Pople <[email protected]>
1 parent 988644e commit a6bcc0a

File tree

2 files changed

+153
-339
lines changed

2 files changed

+153
-339
lines changed

0 commit comments

Comments
 (0)