• Welcome to Valhalla Legends Archive.
 

Another Bit Of Help Please....

Started by TriCk, October 26, 2003, 01:43 AM

Previous topic - Next topic

iago

Well, division is about 100x slower than and, so if that code is running a lot it will make a big difference.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Tuberload

Wow. I didn't know the performance differences were that large. Once again thanks for the information, it should help the performance of some of my projects a lot.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

iago

Well, go back to logic gates.  An and is 32 parallel AND gates, which is the same as a single AND gate.

On the other hand, a divide is .. *finds book*.. blast, I'll just link you to a picture:

http://books.elsevier.com/companions/1558604286/pictures/pdf/Chapter4/f0440.pdf
http://books.elsevier.com/companions/1558604286/pictures/pdf/Chapter4/f0441.pdf

Although I'm not totally sure which algorithm is implemented on 80x86 chips, they tend to be slow like that.  And it runs in series, so it takes a hell of a lot longer.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Tuberload

So wouldn't thay make using the AND operator 32X faster than the division operator?
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

Adron

Quote from: iago on October 26, 2003, 05:37 PM
Well, division is about 100x slower than and, so if that code is running a lot it will make a big difference.

On a Pentium it seems to be 25x slower. 1 cycle vs 25. In a very tight loop it would probably be around 6 times slower, and in most loops it might make it 2 times slower.

iago

Quote from: Tuberload on October 27, 2003, 02:54 AM
So wouldn't thay make using the AND operator 32X faster than the division operator?

No, because division doesn't just do one thing per cycle. If it was 32 and gates in sequence it would be different.

It really depends on the processor.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Etheran

Think about what division actually is.  It's like looped subtraction.  so of course that's going to take longer than a simple anding.