[Freebasic 32 vs 64]
[Freebasic 32 vs 64]
Freebasic 32 bit generates code asm ...
Freebasic 64 bit generates code C ...
I did not know it. I only recently installed 64-bit freebasic ...
it is obvious that the assembler is and has always been faster than the C. which explains that 32 bit programs are much faster than 64 bit ...
for information.
Freebasic 64 bit generates code C ...
I did not know it. I only recently installed 64-bit freebasic ...
it is obvious that the assembler is and has always been faster than the C. which explains that 32 bit programs are much faster than 64 bit ...
for information.
Re: [Freebasic 32 vs 64]
This is only partly correct (insufficient information):
FBC 32 can also output C code (which requires GCC 32 bit installation).
Default is: -gen GAS
FBC 64 is by default: -gen GCC (can do: code optimisations, which GAS can't).
GCC is used to output the assembly code, that is further processed by AS and LD.
Assembler & Linker e.t.c., from BinUtils (aka: -gen GAS).
This means: the same tools are used (in the end), independent of the code output
by FBC ... (GAS straight away, or GCC as inbetween step).
Your conclusions are therefore not very well reasoned.
FBC 32 can also output C code (which requires GCC 32 bit installation).
Default is: -gen GAS
FBC 64 is by default: -gen GCC (can do: code optimisations, which GAS can't).
GCC is used to output the assembly code, that is further processed by AS and LD.
Assembler & Linker e.t.c., from BinUtils (aka: -gen GAS).
This means: the same tools are used (in the end), independent of the code output
by FBC ... (GAS straight away, or GCC as inbetween step).
Your conclusions are therefore not very well reasoned.
Re: [Freebasic 32 vs 64]
I know all that. by default freebasic 32 generates asm code while the 64-bit version generates only C code.
which explains that 32 bit programs are much faster than 64 bit ...
I hope it is more precise.
which explains that 32 bit programs are much faster than 64 bit ...
I hope it is more precise.
Re: [Freebasic 32 vs 64]
If you write information for others to use, this doesn't matter at all.Coolman wrote:I know all that.
Your conclusion is still based of funny assumptions ;-)
(bold print, doesn't change anything)
Re: [Freebasic 32 vs 64]
The test results you are referring to, are without any meaning ...
a) no testing code supplied
b) no testing conditions mentioned (graphics driver used)
(FBC 32 uses DirectX as graphics driver, which isn't available in FBC 64, using GDI, known to be slow)
a) no testing code supplied
b) no testing conditions mentioned (graphics driver used)
(FBC 32 uses DirectX as graphics driver, which isn't available in FBC 64, using GDI, known to be slow)
Re: [Freebasic 32 vs 64]
I use freebasic only for small programs and lazarus freepascal for big projects. the speed difference of the programs (32 vs 64) generated surprised me. that's all. the technical details are not important. I expect a 64 bit program to be faster than a 32 bit program. it's always the case with the other languages I use. this is not the case with freebasic for now. I will use the 32 bit version ...
Re: [Freebasic 32 vs 64]
Maybe more precise, but your conclusion is still wrong. In general asm code is not faster than C code; maybe handwritten asm code, but not asm code generated by FB. And btw the C code is compiled to asm code as well during FreeBasic's internal build process, which you could've seen if you'd have taken a closer look.Coolman wrote:I know all that. by default freebasic 32 generates asm code while the 64-bit version generates only C code.
which explains that 32 bit programs are much faster than 64 bit ...
I hope it is more precise.
However in most cases the opposite is true: C code is faster than than 32-bit asm code generated by FB, because the asm code that is generated from C code is heavily optimized by gcc while FB only supports some basic optimization techniques.
Maybe you're using inadequate methods to measure "speed". In general a 64-bit application isn't faster than a 32-bit one, no matter whether you use FB, C, Pascal or any other programming language to generate native code. Technical details may be not important to you, but knowing them explains why you're wrong, so you may consider having a closer look into them.Coolman wrote:the technical details are not important. I expect a 64 bit program to be faster than a 32 bit program. it's always the case with the other languages I use.
Re: [Freebasic 32 vs 64]
The 32-bit generates assembler from Basic. The 64-bit generates assembler from C.Coolman wrote:I know all that. by default freebasic 32 generates asm code while the 64-bit version generates only C code.
Since C is faster that Basic that explains why 64-bits programs are so much faster than 32-bit.
In general 64-bit can be faster, because it is easier to optimize for with a compiler, provided some conditions are met:
- when the math is relatively simple (x64 often uses SSE fpu, which has slower non basic operations than x87, things like cos etc)
- when the data size is the same. If you blow up the datasize, you hit the cache, which has the same size in 32-bit as 64-bit mode.
- On *nix, the relative speed of 64-bit PIC vs 32-bit PIC comes on top of that.
- runtime libraries can assume sse2 (and in practice even sse3, since most kernels don't support the first generation AMD64 due to missing atomic primitives). This specially means that small moves can be inlined in a better way.
A lot of naive benchmarks and tests blame codegeneration while it is often other factors, like runtime helpers, 64-bit vs 80-bit fpu math etc.
Last edited by marcov on Jan 28, 2019 19:55, edited 1 time in total.
Re: [Freebasic 32 vs 64]
marcov wrote:... that explains why 64-bits programs are so much faster than 32-bit
:-)Coolman wrote:... which explains that 32 bit programs are much faster than 64 bit
Re: [Freebasic 32 vs 64]
well. it is true that using gcc optimization options in the example I cited the 32 bit program is faster. in that case. why not harmonize freebasic 32 and 64 so that it generates only C code with the default compilation enabled with the option -O2. it would be more logical. and it will optimize the c-generated code in both versions.St_W wrote:Maybe more precise, but your conclusion is still wrong. In general asm code is not faster than C code; maybe handwritten asm code, but not asm code generated by FB. And btw the C code is compiled to asm code as well during FreeBasic's internal build process, which you could've seen if you'd have taken a closer look.Coolman wrote:I know all that. by default freebasic 32 generates asm code while the 64-bit version generates only C code.
which explains that 32 bit programs are much faster than 64 bit ...
I hope it is more precise.
However in most cases the opposite is true: C code is faster than than 32-bit asm code generated by FB, because the asm code that is generated from C code is heavily optimized by gcc while FB only supports some basic optimization techniques.
Maybe you're using inadequate methods to measure "speed". In general a 64-bit application isn't faster than a 32-bit one, no matter whether you use FB, C, Pascal or any other programming language to generate native code. Technical details may be not important to you, but knowing them explains why you're wrong, so you may consider having a closer look into them.Coolman wrote:the technical details are not important. I expect a 64 bit program to be faster than a 32 bit program. it's always the case with the other languages I use.
that said. i can assure you that 64 bit programs generated by lazarus freepascal are much faster than 32 bit ones.
Re: [Freebasic 32 vs 64]
On Windows or on Linux ?Coolman wrote: that said. i can assure you that 64 bit programs generated by lazarus freepascal are much faster than 32 bit ones.
Re: [Freebasic 32 vs 64]
Windows
Re: [Freebasic 32 vs 64]
Make sure you recompiled everything with -dTEST_WIN32_SEH and appropriate -Cf parameters.Coolman wrote:Windows
By default win32 has a slower exception system than win64, but that is historic and will hopefully be fixed soon.
Re: [Freebasic 32 vs 64]
I did not know this setting, I use classic optimizations. you mean with this setting. 32 and 64 bit programs have an equal execution speed?marcov wrote:Make sure you recompiled everything with -dTEST_WIN32_SEH and appropriate -Cf parameters.Coolman wrote:Windows
By default win32 has a slower exception system than win64, but that is historic and will hopefully be fixed soon.