Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Wine
Reload this Page Does WINE runs faster than Windows
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Wine Discussion about Wine, the Open Source implementation of the Windows API on top of X and Unix.

Reply
 
Thread Tools Display Modes
Old 04-29-2008   #1 (permalink)
nabilchampion
Just Joined!
 
Join Date: Nov 2007
Posts: 12
Unhappy Does WINE runs faster than Windows

Hi all,

I am working on a porting project(Windows to Linux). Recently I tried to have analysis of the Windows natively developed application processing time in Windows and in WINE. That means i compiled a small test application in Windows and then executed it first on Windows (XP) platform and noted the time. And then I executed the sane Windows exe on the Linux with WINE.
This test application took 7.5 to 8 Seconds in Windows while to my wonder the same exe took 5 to 6 seconds on the average at Linux with WINE. Also more to my wonder is that I am running OpenSuSE 10.3 at VMware with the Windows XP as a host.

I am very suspicious about this. I have tested more and more times but each time I have the same result. Then I compiled the same code natively on Linux and it also took 7 to 8 seconds on the average but why in the hell the application that is Windows native is running faster in WINE.

Can anyone tell me that whether WINE is so fast or I am having wrong results. I need to have this analysis but my results look weird to me.

Here is the code of my test application:
Code:
#include "stdafx.h"
#include <stdio.h>
#include <iostream.h>
#include <time.h>
#define MAX 50000

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
 	// TODO: Place code here.A
	
     clock_t  start ;double end ;
     start = clock();
     cout<<"\n starting clock is "<<start<<endl;

    __int64 itr, itr1;
    FILE*fp;
	
    for(itr=0;itr<=MAX;itr++)
	 {
		   ;;
	 }
   for(itr1=0;itr1<=50;itr1++)
	 {
        	 if((fp=fopen("C:\\test\\testingspeed.txt","w"))==NULL)
	           {
		           return 0;
	           }

	         for(itr=0;itr<=(20*(MAX+MAX));itr++)
	           {
	     	       fputc(itr,fp);
	           }
                 fclose(fp);
	   }

	 
	 end = clock();

	 cout<<"\n ending clock is "<<end<<endl;

	 double totalTimeConsumedbythis = (end - start)/CLOCKS_PER_SEC;

	 cout<<"\n total clock time is "<<totalTimeConsumedbythis<<endl;

	 char buff[50];
	 memset(buff,0,50);
	 int ret=sprintf(buff,"%f",totalTimeConsumedbythis);
	 buff[ret]='\0';
	 fp=fopen("C:\\test\\timediff.txt","w");
	 fwrite(buff,strlen(buff),ret,fp);
	 fclose(fp);	 

	return 0;
}
I also used "time" utility of Linux to calculate the time taken by the application for my satisfaction
If there is any other better way to analyze the performance difference of the application running in Windows natively and in WINE then let me know plz.
nabilchampion is offline   Reply With Quote
Old 04-29-2008   #2 (permalink)
knapie
Just Joined!
 
Join Date: Apr 2008
Posts: 2
Hallo

I am by no means a Wine/Windows expert. However you might want to keep the following in mind.

You are writing to a file. In VMWare you have a harddisk simulation layer that must translate your disk access to a virtual disk on an linux filesystem.

Therefore you write to a file on NTFS or VFAT or whatever in your vmware and that gets translated to a virtual disk and then that gets written to a linux filesystem of some sorts.

When you run the same software under wine, at least the disk access should have less software layers and should be quite a bit quicker.

Over and above that you have the same effect with screen access etc, everything in vmware is virtual and must be translated to the real world linux machine interface.

Then last but not least, NTFS for instance is slow. Linux generally manages memory much better then Windoze. etc. So yes even if you run windows natively you might find your wine app faster. I use Wine a lot in conjunction with Crossover Office running even Windows network testing related software and it works very well.

Knapie
knapie is offline   Reply With Quote
Old 04-29-2008   #3 (permalink)
IsaacKuo
Linux User
 
IsaacKuo's Avatar
 
Join Date: Feb 2005
Location: Baton Rouge, LA, USA
Posts: 286
Send a message via ICQ to IsaacKuo Send a message via Yahoo to IsaacKuo
Quote:
Originally Posted by nabilchampion View Post
That means i compiled a small test application in Windows and then executed it first on Windows (XP) platform and noted the time. And then I executed the sane Windows exe on the Linux with WINE.
This test application took 7.5 to 8 Seconds in Windows while to my wonder the same exe took 5 to 6 seconds on the average at Linux with WINE. Also more to my wonder is that I am running OpenSuSE 10.3 at VMware with the Windows XP as a host.

I am very suspicious about this.
Don't worry about it. The first thing to keep in mind is that WINE is not an emulator. It's essentially an application interface which looks like Windows to the application. There's no reason why the application should run any faster or slower than Windows. What IS different is the code behind the application interface. That's where speed differences may lie. Some of it may be more efficient in Windows. Some of it may be more efficient in WINE.

With a difference of just a couple seconds, it's a bit hard to guess exactly what's going on. It might be something as mundane as a virus scanner checking to make sure the newly created file doesn't have a virus on it (you'd have a virus scanner running in Windows, but not WINE). Or it could be that OpenSUSE has more efficient file system I/O.

I disagree with the previous opinion, though...the VMWare OpenSUSE would definitely have MORE software layers going on. You've got a virtual disc residing on an NTFS partition, which OpenSUSE thinks is a "real" disc with an ext3 partition. So, your application sends write commands to OpenSUSE, which then hits the virtual disc that VMWare handles, and then ultimately VMWare writes those changes to the virtual NTFS disc via Windows's file system I/O.

Note that the last step actually uses Windows's own file system I/O. So theoretically, there's no way the file system I/O could be faster, right? Except...it's not as simple as all those layers acting byte for byte. Modern file system I/O is buffered, so "chunks" of data get moved around instead of doing everything byte-by-byte. Disk writes never occur immediately, which is obvious whenever you run into the "Windows Delayed Write Failed" error.

So, your program will complete before the data is all written to the disc. OpenSUSE might think the data has finished writing while in reality VMWare hasn't flushed all of the differences to Windows yet (and Windows has delayed write as well).

With a difference of only a few seconds, it's hard to say whether there is actually any performance difference in your programs, or if it's just some differences in how "delayed writes" are being handled.
__________________
Isaac Kuo, ICQ 29055726 or Yahoo mechdan
IsaacKuo is offline   Reply With Quote
Old 04-30-2008   #4 (permalink)
nabilchampion
Just Joined!
 
Join Date: Nov 2007
Posts: 12
Ok..
I did get much info from above two posts... But I want to get advantage of this thread and want to ask that Does WINE runs application faster or at least equal to the application running purely natively in Linux. I know that common sense answer is that the application native to the Linux shall be fastest. But I actually compiled the same code shown above with the WINELIB and then again I compiled it purely natively in Linux with gcc. Then I calculated the time for all the tests. And I found that the application compiled with WINELIB was equal in time to the application compiled natively on linux. But the Windows binary version application when executed with WINE was faster than all. Now How come this possible. I need to know that theoretically is this possible that the application running over WINE is processed faster than the Linux native application/binary.
Regards
nabilchampion is offline   Reply With Quote
Old 04-30-2008   #5 (permalink)
IsaacKuo
Linux User
 
IsaacKuo's Avatar
 
Join Date: Feb 2005
Location: Baton Rouge, LA, USA
Posts: 286
Send a message via ICQ to IsaacKuo Send a message via Yahoo to IsaacKuo
Since your program spends most of its time doing file output, and the time differences are only on the order of a few seconds, it's hard to even say which program is really running significantly faster than any other. If you really want to test performance, you really need to let the programs run long enough that the different ways file output buffer are flushed don't swamp the results.

Better yet, remove file output from the main loop of the program. As it is, you're testing the speed of different methods of file output more than the speed of your own program.

Anyway, are you using the same compiler for the Windows binary version as the others? It sounds like you aren't, so it could easily be that the Windows compiler you're using is optimizing the code better than gcc.

Quote:
I need to know that theoretically is this possible that the application running over WINE is processed faster than the Linux native application/binary.
When you introduce as many extraneous variables as you have, sure thing. In general, an application running in WINE will run the same speed as a Linux native application.

Why do you need to know?
__________________
Isaac Kuo, ICQ 29055726 or Yahoo mechdan
IsaacKuo is offline   Reply With Quote
Old 04-30-2008   #6 (permalink)
i92guboj
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 886
It's already been said: tests must be done without intermediate layers, and limiting the involved factor to the bare minimum. If possible, you should use the same or similar compilers as well, and the same optimization levels.

Running tests on a virtual machines is a no-go, unless you are specifically testing the vm itself.

Now, about wine: someone already said that as well. Wine is just an alternative implementation of the windows api on linux and xlib, but using completely re-written from scratch source code. That means, basically, that if the wine people implemente given funciton to be faster than one of MS, then it will be faster. But, overall, I don't think it is. It might depend on the concrete pieces that a program uses.

It also might depend on the underlying code involved, and I am speaking now about the linux kernel and xlib, mostly.

A note: if you are porting an application, you might want to consider porting it as a winelib application. Winelibs apps links against wine but are native linux programs. It might be a good idea if your app uses lots of windows specific code.
i92guboj is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 11:43 PM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0