- A Comparative Performance Analysis of Longene VS Wine
- 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]
- 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.
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
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
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 2467 112 23 7 6 2434 106 20 7 8 2478 72.70 20.90 7.10 6.40 1935.20
FileTest Write Number 100 Read Number 100 Time 73ms RegTest Write Number 100 Read Number 100 Time 95ms MesTest 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.
Your position is :Home > Development > Test Analyze