[PATCH] minor regex cleanup: use switch for enum
isaac.r.levy at gmail.com
Tue Apr 24 00:42:24 UTC 2018
On Mon, Apr 23, 2018 at 5:18 PM David Lloyd <david.lloyd at redhat.com> wrote:
> FWIW I strongly doubt this will improve performance; probably the
> opposite in fact, as IIRC an enum switch generates an extra class
> (though perhaps this has changed). The original code was quite
> compact and utilized identity comparisons, and given there are only
> three alternatives it probably was able to exploit branch prediction
> as well (if such a thing even matters in this context).
Well, there are enum switches on the same enum elsewhere in the class, so
should those instead be replaced by if checks? A larger change could remove
this branch entirely, with different classes for each of the types, which
are known during compile.
More information about the core-libs-dev