Recent

Author Topic: What is the advantages of 64-bit version of app created with Lazarus 64 bit?  (Read 6197 times)

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
Hi.
What is the advantages of 64-bit version of app created with Lazarus 64 bit?
Will some CPU-useage code be 2-x faster than 32-bit version of this app?

How i can do this app - simply download Lazarus 64-bit, install on PC (near from 32-bit Lazarus?) and recompile my app - that is all?

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
One of the advantage is you can run your 64bit app to a 64bit operating system but the disadvantage is you cant run your 64bit app to a 32bit operating system.
So I prepare a 32bit app that can run in 32 and 64bit operating system.

About there speed I haven't noticed at all the changes.
Probably it depends on the application programmed.

please someone correct me if I'm wrong.


jwdietrich

  • Hero Member
  • *****
  • Posts: 1269
    • formatio reticularis
Speed is not a major issue that distinguishes 64-bit applications from 32-bit applications (it was different in early days when 32-bit applications were faster than 16-bit applications, which was a consequence of mathematical operations that required multiple steps of memory access and calculations on 16-bit computers and even more on 8-bit systems).

The main advantage of a 64-bit program is that it can handle much larger chunks of memory. This is, however, for most applications not important, as memory requirements are not so high that they can't be fulfilled by a 32-bit processor. Therefore, creating a 32-bit application is for most situations the better choice (also with respect to backward-compatibility, as mentioned by xenblaise).

Only for certain requirements, e.g. supercomputing, large-scale computational statistics or data-warehousing, a 64-bit program may be favourable.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

ChrisF

  • Hero Member
  • *****
  • Posts: 542

Plus, for Windows, you may have to deal with external constraints.

If you are using external DLLs, you have to comply with their own version:
-64 bits programs can only use 64 bits DLLs,
-while 32 bits programs can only 32 bits ones.
(See http://msdn.microsoft.com/en-us/library/aa384231%28VS.85%29.aspx for instance).

Currently, most of the external components are generally coming in both flavors (i.e 32 and 64 bits). But I guess that 32 bits versions will be less and less present in the future.

irfanbagus

  • Jr. Member
  • **
  • Posts: 73
Speed is not a major issue that distinguishes 64-bit applications from 32-bit applications (it was different in early days when 32-bit applications were faster than 16-bit applications, which was a consequence of mathematical operations that required multiple steps of memory access and calculations on 16-bit computers and even more on 8-bit systems).
it is. for example 64 bit application work faster for double data type operation compared to 32 bit application. but you will notice any different only in heavy processing application like 3d games or multimedia processing.
for my application, i always make sure it's 32 and 64 bit safe. if 64 bit version give much better performance, i distributed 2 version. if not, only 32 bit version.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4660
  • I like bugs.
it is. for example 64 bit application work faster for double data type operation compared to 32 bit application.

I guess you mean Int64 type. The same is true for pointer arithmetics. Some DB and other apps address > 4GB memory directly.

One interesting thing is the code size generated by compilers. For an average program it has always been bigger for Intel x86_64 compared to x86.
However compilers should be able to optimize code better for x64 because it has more registers. Also, the instructions working with 64-bit data are not longer than the former 32-bit instructions, except when loading a constant value.

Linux distros typically have a version for both x86 and x86_64. The 64-bit images have been bigger until recently. Now some 64-bit images are smaller, for example Mint 14 + KDE:
 32-bit: 1 097 859 072 B
 64-bit: 1 095 761 920 B
Is it because GCC can now optimize better for x64? I don't know. I didn't find info about it from Google.
Unfortunately FPC is not able to use the registers very well when optimizing.

Juha
« Last Edit: April 06, 2013, 12:14:23 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1269
    • formatio reticularis
Speed is not a major issue that distinguishes 64-bit applications from 32-bit applications (it was different in early days when 32-bit applications were faster than 16-bit applications, which was a consequence of mathematical operations that required multiple steps of memory access and calculations on 16-bit computers and even more on 8-bit systems).
it is. for example 64 bit application work faster for double data type operation compared to 32 bit application. but you will notice any different only in heavy processing application like 3d games or multimedia processing.
for my application, i always make sure it's 32 and 64 bit safe. if 64 bit version give much better performance, i distributed 2 version. if not, only 32 bit version.

Of course, there are rare situations, where 64 bit applications are faster, as long as large integers or pointers to huge memory chunks are concerned.

But, please, read carefully. I wrote that speed is not a major issue. For certain applications yuo might see a benefit from 64 bit code.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12593
  • FPC developer.

 

TinyPortal © 2005-2018