On Sun June 10 2012 19:32:36 Hans Verkuil wrote:
> On Sun June 10 2012 18:46:52 Mauro Carvalho Chehab wrote:
> > 3) it would be interesting if you could benchmark the previous code and the 
> > new
> > one, to see what gains this change introduced, in terms of v4l2-core 
> > footprint and
> > performance.
> 
> I'll try that, should be interesting. Actually, my prediction is that I won't 
> notice any
> difference. Todays CPUs are so fast that the overhead of the switch is 
> probably hard to
> measure.

I did some tests, calling various ioctls 100,000,000 times. The actual call 
into the
driver was disabled so that I only measure the time spent in v4l2-ioctl.c.

I ran the test program with 'time ./t' and measured the sys time.

For each ioctl I tested 5 times and averaged the results. Times are in seconds.

                                        Old             New
QUERYCAP                        24.86   24.37
UNSUBSCRIBE_EVENT       23.40   23.10
LOG_STATUS                      18.84   18.76
ENUMINPUT                       28.82   28.90

Particularly for QUERYCAP and UNSUBSCRIBE_EVENT I found a small but reproducible
improvement in speed. The results for LOG_STATUS and ENUMINPUT are too close to
call.

After looking at the assembly code that the old code produces I suspect (but it
is hard to be sure) that LOG_STATUS and ENUMINPUT are tested quite early on, 
whereas
QUERYCAP and UNSUBSCRIBE_EVENT are tested quite late. The order in which the 
compiler
tests definitely has no relationship with the order of the case statements in 
the
switch.

This would certainly explain what I am seeing. I'm actually a bit surprised that
this is measurable at all.

Regards,

        Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to