[Bug 57061] New: SRWLock is slower than CriticalSection on wine. Why?
https://bugs.winehq.org/show_bug.cgi?id=57061 Bug ID: 57061 Summary: SRWLock is slower than CriticalSection on wine. Why? Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs(a)winehq.org Reporter: euloanty(a)live.com Distribution: --- https://github.com/cppfastio/fast_io/blob/next/benchmark/0002.file_io_tsc/ti... [cqwrteur(a)DESKTOP-9B705LH time]$ wine ./iobuf_file_lockable_critical_section.exe output:0.3784567s input:0.1407622s [cqwrteur(a)DESKTOP-9B705LH time]$ rm *.txt [cqwrteur(a)DESKTOP-9B705LH time]$ wine ./iobuf_file_lockable_srwlock.exe output:0.5857926s input:0.3284965s [cqwrteur(a)DESKTOP-9B705LH time]$ rm *.txt This is very strange tbh. Because on windows SRWLock is faster than CriticalSection. I have checked wine's implementation and I don't see why SRWLock is slower than CriticalSection on wine either since the implementation is very simple. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 cqwrteur <euloanty(a)live.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |euloanty(a)live.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 Zeb Figura <z.figura12(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |z.figura12(a)gmail.com --- Comment #1 from Zeb Figura <z.figura12(a)gmail.com> --- What kind of numbers do you get on Windows (ideally on the same hardware?) -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 --- Comment #2 from cqwrteur <euloanty(a)live.com> --- (In reply to Zeb Figura from comment #1)
What kind of numbers do you get on Windows (ideally on the same hardware?)
D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time>clang++ -o iobuf_file_lockable_srwlock.exe iobuf_file_lockable.cc -O3 -std=c++26 -I../../../include --target=x86_64-windows-msvc --sysroot=D:\toolchains\windows-msvc-sysroot -D_DLL=1 -lmsvcrt -fuse-ld=lld -flto=thin D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time>clang++ -o iobuf_file_lockable_critical_section.exe iobuf_file_lockable.cc -O3 -std=c++26 -I../../../include --target=x86_64-windows-msvc --sysroot=D:\toolchains\windows-msvc-sysroot -D_DLL=1 -lmsvcrt -fuse-ld=lld -flto=thin D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time>del *.txt Could Not Find D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time\*.txt D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time>iobuf_file_lockable_srwlock.exe output:0.1471754s input:0.1363283s D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time>del *.txt D:\msys64\home\unlvs\projects\fast_io\benchmark\0002.file_io_tsc\time>iobuf_file_lockable_critical_section.exe output:0.1584142s input:0.1377649s SRWLock is faster than CriticalSection. I'll send you the binary -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 --- Comment #3 from cqwrteur <euloanty(a)live.com> --- Created attachment 76931 --> https://bugs.winehq.org/attachment.cgi?id=76931 CriticalSection vs SRWLock binary Try yourself with both windows and wine. Wine is much slower while windows is faster for SRWLock. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 --- Comment #4 from cqwrteur <euloanty(a)live.com> --- (In reply to Zeb Figura from comment #1)
What kind of numbers do you get on Windows (ideally on the same hardware?)
I tried it on my android phone and I got the same result. SRWLock is very slow for wine not just on x86_64 but aarch64 too. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 --- Comment #5 from cqwrteur <euloanty(a)live.com> --- The wine version is the git upstream, and I just compiled it from the source yesterday. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 --- Comment #6 from cqwrteur <euloanty(a)live.com> --- Created attachment 76932 --> https://bugs.winehq.org/attachment.cgi?id=76932 Another benchmark with leb128 instead of text https://github.com/cppfastio/fast_io/blob/next/benchmark/0002.file_io_tsc/ti... windows: iobuf_file_lockable_leb128_critical_section.exe output:0.1355566s input:0.1343125s iobuf_file_lockable_leb128_srwlock.exe output:0.1290951s input:0.1271444s wine: $ wine ./iobuf_file_lockable_leb128_critical_section.exe output:0.1806937s input:0.1704513s $ wine ./iobuf_file_lockable_leb128_srwlock.exe output:0.3658482s input:0.3381468s Same binary. SRWLock is nearly 2x slower. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 Fabian Maurer <dark.shadow4(a)web.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4(a)web.de -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
https://bugs.winehq.org/show_bug.cgi?id=57061 William Horvath <wine(a)horvath.blog> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wine(a)horvath.blog --- Comment #7 from William Horvath <wine(a)horvath.blog> --- https://gitlab.winehq.org/wine/wine/-/merge_requests/3504 Just to add to the discussion, here are some results running these benchmarks with and without this patchset applied: Before: CriticalSection output:0.0854515s input:0.0727398s SRWLock output:0.1495588s input:0.1295463s After: CriticalSection output:0.0900452s input:0.0716042s SRWLock output:0.0934296s input:0.0835009s This was after reverting the patchset that superseded it (which doesn't help this benchmark), and applying it to Wine 9.17. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla