Find the answer to your Linux question:
Results 1 to 10 of 10
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. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    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.

  2. #2
    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

  3. #3
    Linux User IsaacKuo's Avatar
    Join Date
    Feb 2005
    Location
    Baton Rouge, LA, USA
    Posts
    406
    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

  4. $spacer_open
    $spacer_close
  5. #4
    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

  6. #5
    Linux User IsaacKuo's Avatar
    Join Date
    Feb 2005
    Location
    Baton Rouge, LA, USA
    Posts
    406
    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.

    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

  7. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    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.

  8. #7
    Just Joined!
    Join Date
    Jul 2008
    Posts
    2

    Wine runs TWICE faster than Vista in LINPACK benchmark

    This may be a more fair comparison. Pure numerical code, no I/O, no graphics, no virtual machine, but huge performance difference.

    I downloaded the C version of the LINPACK Benchmark from The Netlib, and compiled it with MS VC++ 2008. To my surprise, the executable runs more than twice as fast in WINE than it does under Windows Vista.

    My CPU is Intel Core 2 Duo. In Vista the program reported a speed of only 460 kflops, while in WINE it reported about 1000 kflops. When compiled natively in Linux, the speed is similar to that of Wine.

    At first I doubted the output, but I got convinced after I timed it myself with a stopwatch. I'm really puzzled. Anyone can explain?

    The source code is in the attachment if you want to verify the result.
    Attached Files Attached Files

  9. #8
    Just Joined!
    Join Date
    Jul 2008
    Posts
    2

    Er...

    Sorry I think my VISTA may be infected with malware... I tried on another fresh VISTA machine, and WINE was only 20% faster there.

  10. #9
    Just Joined!
    Join Date
    Jan 2008
    Posts
    12
    it is already know that some apps run faster in wine then windows, ex simcity4, but then some run very slowly compared to windows ex, Age of Empires II. It all depends on what the app does and how it does it(wine still has a lot of bugs). but do you really need to test to see if Linux is faster then windows.

  11. #10
    Just Joined!
    Join Date
    Aug 2008
    Posts
    1
    Hi

    I don t know about exactly are you taking about if you are taking bout drinking wine please visit here for more informations

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •