Hi, all. I would just like to share my results: http://influenza.blog.br/wine/testpatch.pdf
I tested in wine-git with and without the patch, plus a XP VM and Windows 7 (no VM). At least in my computer it looks like wine will beat Windows 7 with the patch while the current implementation is as slow as XP running in the VM.
The test files: http://influenza.blog.br/wine/clz.c http://influenza.blog.br/wine/clz.exe
Best regards, Bruno
On Sat, May 31, 2014 at 2:35 PM, Ken Thomases ken@codeweavers.com wrote:
On May 31, 2014, at 12:05 PM, Sebastian Lackner wrote:
Changes in try 2:
- Always try to access the fd cache two times - this ensures that we
don't release a file descriptor when its still in use by a second thread.
Heh. Well, you can ignore that part of my reply to your previous try. :)
- Replace interlocked_xchg() with an assert(). The original code looks
like its valid that the fd is nonzero at this point, but in fact this would cause releasing a file descriptor which is still in use.
I'll leave it to others to comment on that.
Replacing with an assert() also saves a couple of CPU cycles.
I understand that this is an attempt to improve performance, but I don't think it's necessary to squeeze every last CPU cycle out of this code.
-Ken