User specified resolution

Started by
13 comments, last by Kieran 20 years, 3 months ago
Well Keiran, I think the assignment operator '=' runs faster than '|=' operation.Not because it requires comparison....your processor can handle that very well in a single cycle of execution( at the processor level ) If you know a bit of ASM( Assembly Level Language ), then an assignment requires the following one instruction only say:

MOV Mem1,VAL1

where Mem1 is the address of memory location having your DWORD VertexProcessing variable and VAL1 the value to assign to that memory location.Whereas, '|=' could be in ASM as say:

MOV EAX,Mem1
OR EAX,VAL1
MOV Mem1,EAX

As far as i know( I left ASM Programming for quite a while ).
All Calculations concering mathematical or logical operations must contain atleast one operand in a CPU register( The Accumulator ). So,we need to transfer Mem1 to EAX as,the result of an operation is indicated by contents of accumulator and status flags and so,as the final result'|=' should be in Mem1, so is the operation. then perform ORing with the Value and then copy final contents of Acc. to Mem1.

So, Technically speaking, we are saving a few CPU clock cycles in the first case.

[edited by - iron_monkey on January 14, 2004 11:32:38 AM]
Advertisement
But lets be honest, who really cares as its outside the rendering loop! Thanks for the reply though.

[edited by - Kieran on January 14, 2004 2:40:54 PM]
Based on the way that Intel architecture works, I''d be surprised if there was a measurable difference between the speed of "=" and "|=" even in a tight loop. I''d be interested to see results though if someone wanted to run them
Well Im running AMD, not Intel, so would the same apply?
Andy : Ofcourse there is no visual measurable difference in these operations....If you were going to calculate time in nanoseconds or microseconds then these things count.Unless you meant to run your program at an epic time-scale like say a milion years or more ,then only some ''measurable'' difference would occur and that too in say some seconds or less.

As for keiran: The reply was meant for the difference in the execution speed of both operations and was for a more technical understanding rather than saving ''Measurable'' processing times . It has nothing meaningful to do with program development as time difference is negligible( That is why i said "TECHNICALLY" ). As for AMD, i dont know its architecture at all so cant comment on this.

This topic is closed to new replies.

Advertisement