---

A Comparative Performance Analysis of Longene VS Wine

[ Thanks to linooxlee for this link.
]

Test methods:
1. Get a computer with Linux installed.
2. Install Wine and then test it with our test programs. Finally
get the test result.
3. Uninstall wine
4. Get Longene installed, test it with our test programs and then
get the final test result.

Test environment:
model name: Pentium(R) Dual-Core CPU
E5300 @ 2.60GHz
cpu MHz: 2600.000
cache size: 2048 KB
MemTotal: 1032748 kB

MemFree: 857724 kB Buffers: 7872 kB
Cached: 116800 kB

Overwiew of test programs:
TestApi program mainly operates on file, registry and windows
message.
TestAll program integrates all the above operations tested.Tests
program are coded by MFC [source code download:
http://www.longene.org/download/TestCase.rar ].

Test programs flow:
1) According to the number of files, registries and messages
required to test, reader/writer processes are created.
2) File tests: Thread1 first creates a file and waitsThread2 to
read. Then repeat it.
After Thread1 created the file, Thread2 is in charge of read and
delete the file. Then repeat it.
Thread1 and Thread2 synchronize with each other by Event.
3) Registry tests:
Thread3 first creates an registry key, and waits Thread4 to read.
Then repeat it.
After Thread3 created the registry, Thread4 is in charge of read
and delete the registry key. Then repeat it.
Thread3 and Thread4 synchronize with each other by Semaphore.
4) Message test:
Thread5 is responsible for send an message, then waits the main
thread to receive. Then repeat it.
After Thread5 sent the message, the main thread is in charge of
receive the message. Then repeat it.
Thread5 and the main thread synchronize with each other by
Mutex.
5) Test API list:
CreateFile
WriteFile
DeleteFile
CloseFile
RegCreateKeyEx

RegSetValueEx
RegOpenKeyEx
RegCloseKey
RegQueryValueEx
RegDeleteKey
PostMessage
GetMessage
CreateEvent
SetEvent
CreateSemaphore
ReleaseSemaphore
CreateMutex
ReleaseMutex
CreateThread
CloseHandle
WaitForSingleObject
WaitForMultipleObjects

Test result:
    The following datas use ms as the unit. The test consists of 10 groups and each group tests 100 times.

Longene0.3:

TestApi:

WriteFile________ReadFile________WriteReg________ReadReg___________MsgTest
____34_______________7_______________1_______________1_______________149
____23_______________6_______________1_______________1_______________157
____34_______________6_______________1_______________1_______________177
____44_______________6_______________1_______________0_______________197
____56_______________6_______________1_______________0_______________216
____65_______________6_______________1_______________0_______________253
____73_______________7_______________1_______________0_______________274
____86_______________6_______________1_______________0_______________297
____95_______________6_______________1_______________0_______________307
____91_______________6_______________0_______________0_______________313
____60.10____________6.20____________0.90____________0.30____________234.00

TestAll:
FileTest Write Number  100  Read Number     100   Time 20ms
RegTest Write Number  100   Read Number    100   Time 8ms
MesTest Send Number  10000 Recieve Number 10000 Time 184ms
All Time 207ms

Wine 1.0:

TestApi:

WriteFile________ReadFile________WriteReg________ReadReg___________MsgTest
____44_______________21______________7_______________6_______________900
____35_______________20______________8_______________7_______________1147
____45_______________21______________7_______________6_______________1455
____59_______________19______________7_______________6_______________1731
____69_______________22______________6_______________6_______________2007
____75_______________20______________7_______________6_______________2286
____85_______________21______________7_______________6_______________2467
____97_______________22______________8_______________7_______________2447
____112______________23______________7_______________6_______________2434
____106______________20______________7_______________8_______________2478
____72.70____________20.90___________7.10____________6.40____________1935.20

TestAll:
FileTest Write Number 100 Read Number 100 Time 73ms
RegTest Write Number 100 Read Number 100 Time 95ms
MegTest Send Number 10000 Recieve Number 10000 Time 1222ms
All Time 1270ms

Performance improvement:
        WriteFile:      17.33%
        ReadFile:       70.33%
        WriteReg:       87.32%
        ReadReg:        95.31%
        MsgTest:        87.91%
        Summation:      83.70%

Test analysis:
Now we take file write operation as an illustration.Wine at least
executes the following operations:
1) Client process sends the get_handle_fd request to wineserver
process. Note that there should be two system calls, one is the
write system call to pipe by send_request function, and the other
is the read system call to pipe by wait_reply function.
2) Wineserver is scheduled and runs.
3) Wineserver find the opened file descriptor of target file in the
client process in terms of the handle, and sends it to the client.
There must be at least 3 system calls involved. One is the write
syscall to pipe by send_reply function, next is the poll syscall
alike select syscall and the read syscall to pipe by read_request
function.
4) Client process is scheduled to run.
5) Client process makes use of dup syscall to duplicate a new
temporary file descriptor.
6) Client process calls write syscall to write the file by the
duplicated file descriptor.
7) Client process calls close syscall to close the duplicated file
descriptor.

In contrast, Longene don’t have the mentioned schedule operations
in 2 and 4 above because of wineserver’s removal. Longene has fixed
the send_reply and read_request’s implementation from inter-process
communication to system call. So it decreases the time spent in
inter-process communication.

As to the performance, the question is the twice process schedule.
When client process sends request to wineserver with IPC,
wineserver wakes up. Then kernel schedules and switches to
wineserver. Obviously, we users want wineserver to be scheduled at
once for quick response. But the case may be as follows: There is
another higher priority process became ready, so wineserver will be
delayed.

Similarly, after wineserver replies to the client process with IPC,
client process has a chance not scheduled to run at once.

File performance test mainly depends on the disk I/O. Although
longene can save the time spent in process schedule, it cannot
avoid the time spent in disk I/O. We can see the point from the
write and read performance difference. Every time writing file, new
file must be created; while reading file, we open existed files. So
for write file operation, there is more disk I/O than read file
operation. And this also explains why the performance improvement
of write file is less.

The performance difference of the registry test is obvious because
of the twice process schedule. The time spent in registry
read/write is about 1ms for longene, while the time spent in
process scheudle is about serveral ms. And the time spent in
registry operation is trivial.

The message performance test is as same as the registry test. Now
we take input message as an example.
1) Wine first gets the input message from X11.
2) Wine puts the former input message into wineserver.
3) Wine gets the input message from wineserver.

Therefore, Wine has two more communications with wineserver than
Longene. And both wine and longene cannot avoid interacting with
X11.

Just before the test, Wine-1.2 RC1 was released. So we test it
whose results is almost as same as wine 1.0. To some extent, the
performance improvement of Wine is trivial because of its
architecture. And Wine puts more emphasis on the improvement of
compatibility.

longene.org

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis