dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: Are 64-bit applications better than 32-bit applications on a 64-bit system?

  1. #1
    Join Date
    Nov 2018
    Posts
    19

    Are 64-bit applications better than 32-bit applications on a 64-bit system?

    64-bit systems can run 32-bit applications just perfectly. So question arises, is there any difference between using a 32-bit and a 64-bit version of the same application, IF the application does not consume a lot of memory.

    So is there difference in performance as well? In any way??

    If there is performance difference then I have to pack both a 32-bit and a 64-bit version into an installer otherwise I can just give every windows system a 32-bit since all windows can run 32-bit.

  2. #2
    Join Date
    Nov 2018
    Posts
    19

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Also, bonus question,

    If I compile a game, and distribute it to users, can I give updates to the game without having the user redownload the installer again?
    To allow updating the game, what should I do? How does it work?

    Do I make many source files, but then all of them are merged into one executable..

    Can I not use compilers if I had to send updates to a game? Should I use an interpreter? But then even the interpreter gives an executable.. right?

  3. #3
    Join Date
    Jan 2013
    Location
    Dallas, TX
    Posts
    215

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Did you GOOGLE your first question?? Here is one helpful answer:

    Choose between the 64-bit or 32-bit version of Office
    https://support.office.com/en-us/art...e-6c6f49b8d261

  4. #4
    Join Date
    Nov 2018
    Posts
    19

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Yes I did it said that 64-bit applications can access more memory addresses.

    But I play a game which takes very little RAM it's a small 60MB game on PC and its installer has both a 64-bit and a 32-bit version. But since this game doesn't need much RAM, why would it opt to have a 64-bit at all?

    It could have instead used just a 32-bit version (decreases file size by 2 times) for all users or let the user optionally take 64-bit from the website but it forces 64-bit on all 64-bit systems. But why?

    It doesn't make any difference because it's a small game right? So why is this game forcing everybody to download twice the file size?
    So does 64-bit also have better performance? But I didn't find anything like that on Google.

    I'm not very knowledgeable in computers.

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,730

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Whether 32 bit or 64 bit programs are faster on 64-bit cpu's depends on what the program is doing, optimisations used etc etc. With tests I've done (not gaming), some 64-bit are faster and some are slower than their 32-bit version. The main point of 64-bit code is to utilise additional memory over that of 32-bit programs. Without knowing the details of code (or performance benchmarks) it's not really possible to say which is faster.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.1.6)

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,011

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    You might want to look into the history of Windows NT. Learn it from the ground up and understand how it started out life as a 32-bit user and kernel OS with a DOSWow layer that allowed 16-bit applications to run. Take a look at Win95 which was a 32 bit user layer on the old 16-bit DOS kernel. WinNT evolved into Win2000, XP and into current versions. Somewhere alone the line, the 64-bit version was introduced and 16-bit support was dropped and 32-bit thunking was added. Thunking (which may be called something else) is translating the non-native calls back and forth. In NT, this was 16-bit to 32-bit and 32-bit back to 16-bit. The idea was the 16-bit app really had no idea it was running on a 32-bit OS. A 32-bit app runs on the 64-bit OS in the same manner, i.e through the 64-bit to 32-bit thunking layer.

    In terms of your app, understand that a 32-bit app will thunk for every OS system call. If your app uses 3rd party 32-bit dll or COM objects, you'll need to code for 32-bit; otherwise, you may want to strongly consider coding for 64-bit. By coding with 64-bit, your app won't have to thunk and will be supported longer into the future (as support for 32-bit, like 16-bit will eventually go away in future OS versions).

    In terms of the questions you are asking, I'd strongly suggest getting the books recommended to you in previous posts. The information in these books with give you the necessary background on the inner workings of the OS. It is increasingly difficult to find this info on the internet as all the older info gets replaced with newer. Not many people start coding using the WinAPI or with MFC/ATL, so the old documentation is scarce. There aren't that many relics out there like myself left to answer question, so I really stress you getting a good foundation from the books rather than relying on forums trying to explain the details of what the books already cover.

  7. #7
    Join Date
    Nov 2018
    Posts
    19

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    I'd strongly suggest getting the books recommended to you in previous posts.
    Arjay I am interested in reading books. Sorry if I am being really dumb..
    But where had you recommended books? I checked every post I had created but couldn't find the post you're referring to.. I checked posts from your profile too..

    You had mentioned this in another thread too, I was confused and I thought that there were book recommendations somewhere by codeguru..

    Again sorry if I'm being dumb.


    2kaud, did you use any tool to check which application ran faster? If yes, then what did you use?

    Thanks for replying guys. I guess I'll have to do some testing to understand. I'll compile different codes in both 32bit and 64bit and try to understand how differently they work. Would you suggest any tools for seeing how the binary files are being handled by the OS?

    About thunking, the game I play is constantly being updated. So if there were a case where thunking was no longer supported, they could just update the game once more and release a new installer.

    Let me clarify, although thunking is a type of 'deprecation', it doesn't mean that the same calls to non-native 32-bit are different than 64-bit native calls in terms of efficiency right? So you could take advantage of 32-bit support - in that you don't have to include two versions in an installer but just one that is the 32-bit one.
    Last edited by Numb; January 10th, 2019 at 09:46 PM.

  8. #8
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,011

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    You're right the book referrals are in a different user's post. The post is http://forums.codeguru.com/showthrea...n-the-Mainform

    The books are from Charles Petzold and Jeffrey Richter. They cover the fundementals of Windows programming.

  9. #9
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,011

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    As far as performance, 32 on 64 will be slower for Win32 api calls. As mentioned, every 32-bit API call gets converted twice to/from the equivalent 64-bit API. How much this slows down your app depends on how frequent api calls are made.

  10. #10
    Join Date
    Nov 2018
    Posts
    19

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Oh okay, so if I weren't using the Win32 api I wouldn't have to worry about making a separate 64-bit version for my application. The only other time I need to worry about having a 64-bit version is when my application takes more than 4gb ram?

    Thanks a lot I'll take a look at the books. But aren't they a bit old? But I get that it'll give me a good foundation.
    Last edited by Numb; January 11th, 2019 at 02:57 AM.

  11. #11
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,730

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Quote Originally Posted by Arjay View Post
    As far as performance, 32 on 64 will be slower for Win32 api calls. As mentioned, every 32-bit API call gets converted twice to/from the equivalent 64-bit API. How much this slows down your app depends on how frequent api calls are made.
    Yep. How much this impacts, of course, is down to how many WIN32 api calls are used, how much com is used etc etc etc. The measurements we did for performance were for 'pure' c++ programs.

    As one of 'the relics', I've gone from DEC PDP/VAX programming (basic/assembler) through CP/M to MS-DOS (using Turbo assembler/c) via Pick (Basic/Assembler) onto Windows 2 (that was really fun!) then through Windows 3.1, Windows 95, NT, 2000 etc etc. Back in the 'good old days' there was no such thing as 'the Internet' what you learned was from colleagues, contacts, user group meetings, books and 'the manuals'. Way back then you used to get proper manuals - nice thick ones and in a ring binder if you were lucky. You experimented, you worked things out, you got to know how things were done.

    Unlike old books on c++ (which are totally out of date and shouldn't be used), old books on WIN32 are still mostly relevant. OK, we no longer do 16-bit windows programming, but a bit of background knowledge will let you know where say the windows type LPSTR came from (long pointer to string - look up what is a long pointer!). Much of the ground work that was done for Windows 2/3 is still there in Windows today. Some of the functions have been depreciated and there are some new ones but reading say a book on Windows 95 UI programming (the first that used the new WIN32 API) is pretty much still the same for win32 UI programming in Windows 10. Not that many programmers now code UI in WIN32, but for those of us that did at one point we got the lower-level understanding which is becoming more and more absent from 'modern' ui programming in say .net or qt. IMO reading the 'old' Windows programming books gives an insight which really isn't there in the new books. Petzold, Richter and Simon (API bibles) together with the Microsoft Resource Kit books were 'must haves' - which I've still got.

    If you have performance issues, then you need to know what is going on 'under the hood' and only knowledge about how things work at that level will help.

    If you look on Amazon etc, many of these 'old books' are available second hand quite reasonably priced. IMO if you are interested in 'how' Windows programming, then I would look into obtaining some of these.

    Have fun!
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.1.6)

  12. #12
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,011

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Quote Originally Posted by Numb View Post
    Thanks a lot I'll take a look at the books. But aren't they a bit old?
    But, aren't you using old technology? I mean, haven't we explained that you can't find this on the internet anymore because it is old technology?

  13. #13
    Join Date
    Feb 2017
    Posts
    445

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Quote Originally Posted by Numb View Post
    64-bit systems can run 32-bit applications just perfectly. So question arises, is there any difference between using a 32-bit and a 64-bit version of the same application,
    There may be a difference in perception like "64 bit is the future while 32 bit is the past". A 64 bit program may subjectively feel faster and better than a 32 bit equivalent even when it objectively isn't. So for reasons of perceived quality I would ship both 32 and 64 bit versions, especially if the target group is gamers. But that's for the time being. We're in a transitions period now that will end in 5 years or so. Then I think 32 bit has largely faded away.

    Fortunately, most (if not all) IDEs allow you to generate both 32 and 64 bit executables from a single code base. This makes it easy to develop both versions in parallel with almost no extra effort.

    So I think at this point commercial software should be distributed as both 32 and 64 bits. Even though there's probably little performance difference between these versions it signals the company is forward looking without leaving anyone behind.
    Last edited by wolle; January 25th, 2019 at 07:52 PM.

  14. #14
    Join Date
    Jan 2019
    Location
    Slough
    Posts
    20

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    When you launch 32-bit versions of software on 64-bit systems of the Windows family, old 32-bit applications are executed a bit slower because of the WoW64 subsystem which emulates the 32-bit environment. An average performance loss because of this WoW64 layer is 2-3%, although in some special cases it might be much more.

  15. #15
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,730

    Re: Are 64-bit applications better than 32-bit applications on a 64-bit system?

    Quote Originally Posted by John Aeliya View Post
    When you launch 32-bit versions of software on 64-bit systems of the Windows family, old 32-bit applications are executed a bit slower because of the WoW64 subsystem which emulates the 32-bit environment. An average performance loss because of this WoW64 layer is 2-3%, although in some special cases it might be much more.
    WoW64 subsystem is only used for WIN32 API calls. If your software doesn't use WIN32 API calls, (eg is a console program that only uses standard c++) then the WoW64 subsystem is not used and hence no performance loss because of this.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2019 (16.1.6)

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)