Posts: 3,368
Threads: 195
Joined: Jan 2003
Quote: Mod and \ are not the same operation.
Oh, well in that case, mod is still faster! So ignore Blitz and use mod!
Ffix doesn't apply to integers... does it?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 704
Threads: 0
Joined: Dec 2002
MOD and "\" are the same thing? (Are my glasses *that* bad?)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 3,368
Threads: 195
Joined: Jan 2003
he didn't. I thought he did.
but he did say:
Quote:The mod instruction uses division, so you should also avoid it.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 788
Threads: 53
Joined: Nov 2002
Christ, is my english taht bad?
I said MOD USES division, i never said replace mod with division. I said replace mod which are powers of to with AND. Otherwise avoid it in time critical parts.
I didn't even have to write code to know that it's correct, but since you seem keen on me being wrong here.
MODs per second: 37577982
ANDs per second: 390095238
AND is percent faster: 1038
Code:
defint a-z
dim a as integer
dim i as integer, j as integer
dim tmrAIni as double, tmrBIni as double
dim tmrAEnd as double, tmrBEnd as double
dim modspersec as double, andspersec as double
tmrAIni = timer
for i = 0 to 199
for j = 0 to 31999
a = j mod 2
a = j mod 4
a = j mod 8
a = j mod 16
a = j mod 32
a = j mod 64
a = j mod 128
a = j mod 256
a = j mod 512
a = j mod 1024
next j
next i
tmrAEnd = timer
tmrBIni = timer
for i = 0 to 199
for j = 0 to 31999
a = j and 1
a = j and 3
a = j and 7
a = j and 15
a = j and 31
a = j and 63
a = j and 127
a = j and 255
a = j and 511
a = j and 1023
next j
next i
tmrBEnd = timer
modspersec = (32000.0#*200.0#*10.0#) / (tmrAEnd-tmrAIni)
andspersec = (32000.0#*200.0#*10.0#) / (tmrBEnd-tmrBIni)
print "MODs per second:" + str$( clng( modspersec ) )
print "ANDs per second:" + str$( clng( andspersec ) )
print "AND is percent faster:" + str$( cint( andspersec*100.0#/modspersec ) )
oship me and i will give you lots of guurrls and beeea
Posts: 1,439
Threads: 15
Joined: Apr 2003
You said use / for integer division and \ for float division. That's backwards. \ chops off the fractional part of a division.
Posts: 704
Threads: 0
Joined: Dec 2002
I'm calling my eye doctor tomorrow!
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 3,368
Threads: 195
Joined: Jan 2003
anyways, you still don't have a point. What if I want mod 1000, or say mod 1515?
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 788
Threads: 53
Joined: Nov 2002
Oh and the obvious things, which i way to to often see people who're not aware of.
Do not call a routine to move say just one object, make a routine that moves all of the objects in that same call. QB subs/functions are horribly slow, it amazes me that back then when qb was made cpu power was a something you had very little of. Yet they made qb which produces such bad code and does so stupid things. Ok, compiler technology wasn't very advanced back then. But it does so many stupid things that just goes against common sense. What were they thinking?
And Agamemnus, just give it up ok? If you have to use it, then you have to use it. Thus me saying "avoid it" and not "don't use it, i'll kill you if you do!!¤%". But there's always a better way, programming is inventing. And if an inventor can't invent, then he/she is pretty screwed aren't they ?
oship me and i will give you lots of guurrls and beeea
Posts: 3,368
Threads: 195
Joined: Jan 2003
Fine, I will, but AND 2^n is not always a substitute for MOD...... and you offer no alternative.
So you ought to say "you should avoid MOD if your number is represented in binary form as a one and a bunch of zeroes."
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."
Visit www.neobasic.net to see rubbish in all its finest.
Posts: 704
Threads: 0
Joined: Dec 2002
And Blitz didn't say "always". He said "when". (That word, conceptually, is sort of like the word "if".)
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.