Code: Select all
//*/
Code block 1
/*/
Code block 2
//*/
Code: Select all
/*/
Code block 1
/*/
Code block 2
//*/
Code: Select all
//*/
Code block 1
/*/
Code block 2
//*/
Code: Select all
/*/
Code block 1
/*/
Code block 2
//*/
Code: Select all
for(int i=0;i<100;i++)
{
x++;
}
for(int i=0;i!=100;i++)
{
x++;
}
Code: Select all
mov DWORD PTR _i$23092[ebp], 0
jmp SHORT $LN6@main
$LN5@main:
mov eax, DWORD PTR _i$23092[ebp]
add eax, 1
mov DWORD PTR _i$23092[ebp], eax
$LN6@main:
cmp DWORD PTR _i$23092[ebp], 100 ; 00000064H
jge SHORT $LN4@main
mov eax, DWORD PTR _x$[ebp]
add eax, 1
mov DWORD PTR _x$[ebp], eax
jmp SHORT $LN5@main
$LN4@main:
mov DWORD PTR _i$23096[ebp], 0
jmp SHORT $LN3@main
$LN2@main:
mov eax, DWORD PTR _i$23096[ebp]
add eax, 1
mov DWORD PTR _i$23096[ebp], eax
$LN3@main:
cmp DWORD PTR _i$23096[ebp], 100 ; 00000064H
je SHORT $LN1@main
mov eax, DWORD PTR _x$[ebp]
add eax, 1
mov DWORD PTR _x$[ebp], eax
jmp SHORT $LN2@main
$LN1@main:
Didn't the Ralf Brown's interrupt list had a doc that documented x86 opcodes and their cycle count. It may be old and targeted at 486 but pentium 4 are still x86s.Both blocks are identical except for the jge and je instructions, which should (as far as I know, intel have become very good at hiding timing reference docs, spent a while yesterday trying to fine some) have identical performance.
The instruction reference has an appendix with latencies and thoughput, which is as close as you can get to cycle counts. Since modern processors are so dynamic, instructions don't take a fixed amount of cycles to execute: memory addressing, cache misses, even uOp starvation can kill your numbers.Kojack wrote:Both blocks are identical except for the jge and je instructions, which should (as far as I know, intel have become very good at hiding timing reference docs, spent a while yesterday trying to fine some) have identical performance.
Code: Select all
Code: Select all
mov eax, 100 ; 00000064H
$LL6@main:
add DWORD PTR _x$[esp+1564], 1
sub eax, 1
jne SHORT $LL6@main
mov eax, 100 ; 00000064H
$LL3@main:
add DWORD PTR _x$[esp+1564], 1
sub eax, 1
jne SHORT $LL3@main
yes it is, but you use NULL in OGRE, so what should we think now?sinbad wrote:NULL is typically the old-style C way, and C++'s strong typing potentially has problems with some compilers definition of NULL as (void*)0 - something that C would ignore but C++ does not if you assign it to something not void*. I'm not sure this is actually an issue any more, but using 0 over NULL is still generally considered better C++ style.
Code: Select all
Node* Node::removeChild(Node* child)
{
if (child)
{
ChildNodeMap::iterator i = mChildren.find(child->getName());
// ensure it's our child
if (i != mChildren.end() && i->second == child)
{
// cancel any pending update
cancelUpdate(child);
mChildren.erase(i);
child->setParent(NULL);
}
}
return child;
}
Code: Select all
foo(void);