CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2006
    Posts
    384

    Cross platform comparison

    Hi,

    Given a command line based C++ application written in pure C++ and using the Standard C and C++ libraries (thus being portable across OSes).

    How would one compare the execution of performance of such an application across the following OSes ?

    Windows , Solaris, Linux, AIX

    For a given application which contains absolutely no OS specific calls (like the above), would there be a difference in execution performance across operating systems ?

    What are the parameters that one needs to consider which contributing to difference in performance across OSes - the source code being absolutely the same ?

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: Cross platform comparison

    I have a little application written both for Windows and for Solaris. Unfortunately, it is so quick, I don't see any difference in terms of performance.

    Moving data inside the processor's registry is very fast.
    Moving data from RAM to registry is slower.
    Moving data to video memory is slower.
    Moving data from or to the disk, is much slower, about 1000 times (but it can be less if data is in the cache).
    Moving data from or to a distant host, is much slower.

    So, performance does not depend much about the machine, but about what the program does.

  3. #3
    Join Date
    Jan 2006
    Posts
    384

    Re: Cross platform comparison

    Thanks olivthill,

    Quote Originally Posted by olivthill2 View Post
    I have a little application written both for Windows and for Solaris.
    So, performance does not depend much about the machine, but about what the program does.
    From your experience. what would you expect a program to do which would bring about performance difference across Unix and Windows system ? Remember, the code base is the same on both.
    For example, would reading a file using streams cause much of a difference across platforms ?

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Cross platform comparison

    I wouldn't expect a significant difference across platforms at all, unless I was using drivers which were suboptimal on one of them. Linux is known for its GPU drivers not being quite as good as those on Windows, for instance.

  5. #5
    Join Date
    May 2009
    Posts
    2,413

    Re: Cross platform comparison

    Quote Originally Posted by humble_learner View Post
    For a given application which contains absolutely no OS specific calls (like the above), would there be a difference in execution performance across operating systems ?
    Say you also use the same computer, then the only variable left is the quality of the compiler.

    So the important factor really is choise of compiler. And because compilers differ in how well they handle different C++ constructs your programming style will be a factor to consider too.

  6. #6
    Join Date
    Apr 2004
    Posts
    102

    Re: Cross platform comparison

    If you are programming something especially processor intensive, you might notice a difference based on CPU Architecture (PowerPC vs. Intel vs. MIPS, 32-bit vs. 64-bit, etc) even if they are all rated at the same GHz. Certain operations may perform quicker on certain processors than others, but it tends to level out unless you are using those particular operations a lot.

  7. #7
    Join Date
    Jan 2006
    Posts
    384

    Re: Cross platform comparison

    Quote Originally Posted by jefranki View Post
    If you are programming something especially processor intensive, you might notice a difference based on CPU Architecture (PowerPC vs. Intel vs. MIPS, 32-bit vs. 64-bit, etc) even if they are all rated at the same GHz. Certain operations may perform quicker on certain processors than others, but it tends to level out unless you are using those particular operations a lot.
    Could you elaborate on what would be processor intensive operations and non-processor intensive operations with respect to C or C++ code ? I suppose a sorting algorithm would be processor intensive while reading a file would be non-processor intensive. Am I correct here ?

    Looks like from this discussion, there are the following key areas that could be reasons for differences - the code being the same
    1. Quality of compiler across the platforms
    2. Device driver implementations across the platforms
    3. Processor architecture coming into play during processor intensive operations

    Given an application coded in pure C++ which takes - say 2 seconds to execute on Windows, is it safe to promise the customer that the execution time will be the same in case the project involves porting to Linux/Unix platforms ?

  8. #8
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Cross platform comparison

    It's safe to say it will probably be similar. There are too many variables to guarantee exactly the same performance.

  9. #9
    Join Date
    Jan 2006
    Posts
    384

    Re: Cross platform comparison

    Thanks Lindley. Any comments on the quote below ?

    Quote Originally Posted by humble_learner View Post
    Could you elaborate on what would be processor intensive operations and non-processor intensive operations with respect to C or C++ code ? I suppose a sorting algorithm would be processor intensive while reading a file would be non-processor intensive. Am I correct here ?

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured