[libhid-discuss] Performance of libhid

Charles Lepple clepple at ghz.cc
Wed Apr 29 12:02:34 UTC 2009


On Apr 29, 2009, at 1:50 AM, shivaprasad javali wrote:

> I did a small test of Opening the handles to my USB device , reading  
> from them and closing the handles 1000 times in a loop to see how  
> long it takes. The test took around 36-37 seconds on Linux where as  
> it took around 12-13 seconds on the Mac. On the mac I am using the  
> IOKit framework that mac provides for the driver. As far as I can  
> tell I am using the libhid correctly and making no unnecessary calls  
> which would slow down the driver.

I would consider opening and closing the handles in the loop to be  
unnecessary when benchmarking. A typical application only needs to  
open the interface one at the beginning.

You should also be able to run the test using libhid on OS X, which  
removes variables related to the platform.

libhid is implemented on top of libusb, which calls IOKit on OS X.  
That's an extra two layers of indirection right there - if you want  
direct access to either IOKit or the Linux hiddev API, it shouldn't be  
too hard to add to libhid.

Also, the HID protocol is not necessarily high-performance to begin  
with, and you are limited by the number of USB transactions that you  
can initiate per second.



More information about the libhid-discuss mailing list