Results are out! Find what you need...fast. Get quick advice or join the chat
Hey there Sign in to join this conversationNew here? Join for free

C++ much faster under Linux?

Announcements Posted on
Applying to Uni? Let Universities come to you. Click here to get your perfect place 20-10-2014
    • Thread Starter
    • 6 followers
    Offline

    ReputationRep:
    Has anyone else noticed that running c++ apps under linux is much faster than under windows? Like twice as fast running apps with the same code?

    Anyone care to explain this?
    • 0 followers
    Offline

    ReputationRep:
    Windows is a piece of ****. No serious programmer uses windows as their OS. Use mac OS or a free linux distro.
    • 0 followers
    Offline

    ReputationRep:
    (Original post by beepbeeprichie)
    Has anyone else noticed that running c++ apps under linux is much faster than under windows? Like twice as fast running apps with the same code?

    Anyone care to explain this?
    Which C++ apps in particular? Microsoft Word, Adobe Photoshop, Mass Effect 3? These are native Windows apps and I don't see them running faster under linux.

    Software that has been ported from UNIX/Linux to Windows can run slower (e.g. Apache) because it has designed to run on UNIX/Linux not on Windows.

    If it's your own apps, how are they being compiled on Linux and Windows? Are they using a compatibility layer (such as Cygwin)? Which other libraries are they using?
    • Thread Starter
    • 6 followers
    Offline

    ReputationRep:
    (Original post by maturestudy)
    Which C++ apps in particular? Microsoft Word, Adobe Photoshop, Mass Effect 3? These are native Windows apps and I don't see them running faster under linux.

    Software that has been ported from UNIX/Linux to Windows can run slower (e.g. Apache) because it has designed to run on UNIX/Linux not on Windows.

    If it's your own apps, how are they being compiled on Linux and Windows? Are they using a compatibility layer (such as Cygwin)? Which other libraries are they using?
    Yeh my own apps. Compiled with GCC. No compatability layer (moved from linux to windows). Using GMP lib.
    • Thread Starter
    • 6 followers
    Offline

    ReputationRep:
    BTW does this:

    void *myfunc(void *vptr_value) {
    int value = *((int *)vptr_value);
    }

    make any sense to anybody?
    • 3 followers
    Offline

    ReputationRep:
    Assuming you're benchmarking properly, this is likely to be a toolchain issue rather than an operating system one. There are differences in e.g. scheduler functionality which might account for some differences, but I'd be looking in a number of other places first. There's no way to say anything more without vastly more information.

    (Original post by beepbeeprichie)
    void *myfunc(void *vptr_value) {
    int value = *((int *)vptr_value);
    }
    That looks an awful lot like something which you probably don't want to be doing. The common exception is interop with a native C library, where a void* 'user state' parameter for callbacks is a standard idiom. In terms of the sample actually making sense, there's not nearly enough context. For starters, the function has no side effects and fails to return the advertised pointer to void.
    • Thread Starter
    • 6 followers
    Offline

    ReputationRep:
    (Original post by TheUnbeliever)
    That looks an awful lot like something which you probably don't want to be doing. The common exception is interop with a native C library, where a void* 'user state' parameter for callbacks is a standard idiom. In terms of the sample actually making sense, there's not nearly enough context. For starters, the function has no side effects and fails to return the advertised pointer to void.
    It comes from pthreads.
    • 3 followers
    Offline

    ReputationRep:
    (Original post by beepbeeprichie)
    It comes from pthreads.
    Which comes from the C world, where it's a standard idiom. Do you have a problem with it, or were you just curious if it was a common construct?
    • Thread Starter
    • 6 followers
    Offline

    ReputationRep:
    (Original post by TheUnbeliever)
    Which comes from the C world, where it's a standard idiom. Do you have a problem with it, or were you just curious if it was a common construct?
    Yeh, just curious.

    Thought to myself WTF is going on here!
    • 0 followers
    Offline

    ReputationRep:
    (Original post by TheUnbeliever)
    Which comes from the C world, where it's a standard idiom. Do you have a problem with it, or were you just curious if it was a common construct?
    pthreads, a common idiom? The POSIX threads library. Seriously?

    If you use UNIX libraries on Windows don't expect to get the same performance as native applications. :facepalm:
    • 3 followers
    Offline

    ReputationRep:
    (Original post by maturestudy)
    pthreads, a common idiom? The POSIX threads library. Seriously?
    I think you've misread: "[pthreads] comes from the C world, where [casting void*-typed 'user state' pointers] is a common idiom."
    • 13 followers
    Offline

    ReputationRep:
    (Original post by barnisaurusrex)
    Windows is a piece of ****. No serious programmer uses windows as their OS. Use mac OS or a free linux distro.
    So almost the entire games industry are not serious programmers?
    • 0 followers
    Offline

    ReputationRep:
    (Original post by Psyk)
    So almost the entire games industry are not serious programmers?
    I think that's what he's saying :turban:
    • 0 followers
    Offline

    ReputationRep:
    (Original post by Psyk)
    So almost the entire games industry are not serious programmers?
    You think professional game developers don't use a unix based OS? Lulz.
    • 12 followers
    Offline

    ReputationRep:
    (Original post by barnisaurusrex)
    You think professional game developers don't use a unix based OS? Lulz.
    ...are you suggesting 'professional game developers' use unix based systems in order to compile programs for Windows? You cannot be serious.
    • Thread Starter
    • 6 followers
    Offline

    ReputationRep:
    (Original post by Chrosson)
    ...are you suggesting 'professional game developers' use unix based systems in order to compile programs for Windows? You cannot be serious.
    This and this
    • 0 followers
    Offline

    ReputationRep:
    (Original post by TheUnbeliever)
    I think you've misread: "[pthreads] comes from the C world, where [casting void*-typed 'user state' pointers] is a common idiom."
    Yes, apologies. It was a response to the original topic (which seems to have derailed somewhat).
    • 0 followers
    Offline

    ReputationRep:
    (Original post by Chrosson)
    ...are you suggesting 'professional game developers' use unix based systems in order to compile programs for Windows? You cannot be serious.

    Don't be daft. You can develop an entire game/program in unix and then just do whatever changes you need to get it to compile on a different platform, of which windows is one of many.
    • 0 followers
    Offline

    ReputationRep:
    (Original post by barnisaurusrex)
    Windows is a piece of ****. No serious programmer uses windows as their OS. Use mac OS or a free linux distro.
    Hi! I'm a software engineer working for a consultancy. The operating systems we use to develop depends entirely on


    1. what the client wants
    2. the technology stack used by the client
    3. the specific expertise of the consultants involved.


    Sometimes we get to suggest technologies, sometimes they are dictated by the client, sometimes we're contributing to an existing project. For example, currently I'm working on a very complicated, multiple tens of millions project that requires a heavyweight client written in C# with a server-side written in a combination of Java and Scala. I write my C# code on a Windows machine, I write Scala on Ubuntu/CentOS. Before that I was working on a Flex & Actionscript web client that talked to a Java server - that was a combination of MacOS and Linux.

    In short, what I'm trying to say is that professionals use whatever tool is right for the job.
    • 0 followers
    Offline

    ReputationRep:
    (Original post by barnisaurusrex)
    Don't be daft. You can develop an entire game/program in unix and then just do whatever changes you need to get it to compile on a different platform, of which windows is one of many.
    Or, you'll have code that imports different sections based on what the compiler, or continuous integration build task, is told the target operating system is

Reply

Submit reply

Register

Thanks for posting! You just need to create an account in order to submit the post
  1. this can't be left blank
    that username has been taken, please choose another Forgotten your password?
  2. this can't be left blank
    this email is already registered. Forgotten your password?
  3. this can't be left blank

    6 characters or longer with both numbers and letters is safer

  4. this can't be left empty
    your full birthday is required
  1. By joining you agree to our Ts and Cs, privacy policy and site rules

  2. Slide to join now Processing…

Updated: April 14, 2012
New on TSR
Article updates
Useful resources
Reputation gems:
You get these gems as you gain rep from other members for making good contributions and giving helpful advice.