shared: add vectorized parse_field() (#7056)
authorVito Caputo <vcaputo@pengaru.com>
Thu, 12 Oct 2017 06:14:07 +0000 (23:14 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Oct 2017 06:14:07 +0000 (08:14 +0200)
commited0545201445ecf2476ba0dd2168afa9052eb9c5
tree600660391354d3aa49745fb9054fc61c5ce2ce13
parent709dbeac14447a06886bdf8d42016f0101bca5a8
shared: add vectorized parse_field() (#7056)

By vectorizing parse_field() the chain of parse_field() calls in
output_short() can be replaced with a single call receiving a description
of the desired fields and their targets.

While at it, eliminate the repeated strlen() calls performed on constant
field names by making parse_field() receive the field length, and storing
it in the ParseFieldVec at compile time.

Also sort the output_short() fields so the short ones are tried first, for
a minor efficiency gain.

In addition to making the code less repetitive, gcc in my tests now inlines
the parse_fieldv() call in output_short().
src/shared/logs-show.c