[dpdk-dev] [PATCH] test/ring: code rework to reduce compilation time
Thomas Monjalon
thomas at monjalon.net
Mon May 4 11:03:06 CEST 2020
30/04/2020 16:43, Ananyev, Konstantin:
>
> Hi Honnappa,
>
> > Hi Konstantin,
> > I like the way the tests are organized and it looks good.
> >
> > I am just wondering about the way it is being tested here. The intent to write the test cases the way they are currently is to mimic how the
> > APIs would be used mostly. IMO, the APIs would be used with a constant value for element size so that the compiler will throw away the
> > unwanted code (in the functions where the actual copy is being done).
> >
> > With your method here, it looks to me like all the branches in the copy functions are kept and the branch decisions are done at run time.
> > Is my understanding correct?
>
> You mean branching on esize[] values?
> Actually from what I've seen that happens for both cases:
> before and after the patch (gcc 7.3 -O3).
>
> Main intention in my changes was to avoid using test_ring_enqueue/test_ring_dequeue,
> as it seems too many branches here and it takes compiler a lot of effort to resolve all
> of them at compile time.
> So I replaced it with array of function pointers (test_enqdeq_impl[]) and iterating over it.
> That way compiler knows straightway which function to use.
In case we choose this solution, please make a v2 including such explanations.
More information about the dev
mailing list