Which data type is faster ?
Which data type is faster ?
I am writing a program making some search in discrete maths (i.e. searching in a graph with adjacency matrix)
Which data type is faster ?
Integer, Short, Ubyte, Long, Longint, Ubyte, etc.
I don't need much calculations other than simple addition or multiplication but I need 2 or 3-dim arrays
Which data type is faster ?
Integer, Short, Ubyte, Long, Longint, Ubyte, etc.
I don't need much calculations other than simple addition or multiplication but I need 2 or 3-dim arrays
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
Thanks
OK for Integer.
My question come from the FAQ that state :
"One area where there is a notable speed deficiency is in 32-bit console modes. While FreeBASIC is consistently on-par with other 32-bit console mode applications, 32-bit console mode operations are significantly slower than 16-bit console operations, as seen in QuickBasic."
So I suppose 32 bit integer in FB is faster anyway that 16 bit.
My question come from the FAQ that state :
"One area where there is a notable speed deficiency is in 32-bit console modes. While FreeBASIC is consistently on-par with other 32-bit console mode applications, 32-bit console mode operations are significantly slower than 16-bit console operations, as seen in QuickBasic."
So I suppose 32 bit integer in FB is faster anyway that 16 bit.
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
In the context of this statement the 16-bit and 32-bit do not refer to data types, but to the type of code: 16-bit real mode code that uses 16-bit addressing, or 32-bit protected mode code that uses 32-bit addressing. The biggest reasons for 32-bit console mode operations being slower than 16-bit console operations are in the design decisions made by Microsoft."One area where there is a notable speed deficiency is in 32-bit console modes. While FreeBASIC is consistently on-par with other 32-bit console mode applications, 32-bit console mode operations are significantly slower than 16-bit console operations, as seen in QuickBasic."
Speed
I read too quickly, sorry
I was desappointed to see some FB code slower than QB !
I was desappointed to see some FB code slower than QB !
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
The slowdown effect can easily be seen with simple programs like this:
Try running it in both QB and FB.
But as long as you're not constantly printing things, FB will be much faster than QB.
Code: Select all
DIM i AS LONG
FOR i = 1 TO 100000
PRINT i
NEXT i
But as long as you're not constantly printing things, FB will be much faster than QB.
I just want to say that it's more of the way BASIC's graphics are set up than "32-bit console operations are slower than 16-bit". Take a look at my conLib library on the forum... it's very fast, the tradeoff is that you have to "flip" before anything is on the console.
Kinda like writing to an off-screen buffer. FB can't do that since all console operations have to be immediately visible.
Kinda like writing to an off-screen buffer. FB can't do that since all console operations have to be immediately visible.
On my Windows 2000 system, the conlib speedtest application does 116 fps, a pure FB version of the code does 3 fps, and equivalent code compiled with QB45 does 181 fps. It looks to me like your library is achieving its speed mostly by replacing the Microsoft console-related functions with faster versions.cha0s wrote:I just want to say that it's more of the way BASIC's graphics are set up than "32-bit console operations are slower than 16-bit".
Good job, BTW.