Pages

Monday, June 7, 2010

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 in 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.

Full Article


No comments: