Re: IF NOTs



rickman <gnuarm@xxxxxxxxx> wrote:
Jonah Thomas <jethom...@xxxxxxxxx> wrote:

Could you perhaps time it on some system? That would settle the
matter for that system.

If you actually got measured results on some system then you'd know
how it worked on that system. That would be more valuable than the
sort of guessing you and I have been doing.

Yes. At the very least it would be instructive to see the true code
generated. A lot of this depends on the compiler efficiency in
generating code. If written in assembly language I have no doubt that
the TRUE case is slower.


I did a quick test on gForth 0.6.2 on a PC and found the true case was
slower in roughly the ratio 8:5. This is small enough that it might be
different on other gForth versions or other PCs.

variable times
100000 times !
: side utime 2>r times @ 0 do dup if else then loop utime 2r> d- d. ;
: side1 utime 2>r times @ 0 do noop loop utime 2r> d- d. ;
: test 0 side 1 side side1 ;

However, in the real world, the difference has got to be minute in the
grand scheme of things in most situations.

With completely empty branches, the do loop took a bit more than half
the time for the false case and a bit less than half the time for the
true case. What you do inside the branches has to be pretty quick for
the timing between true and false cases to matter much. It might make
more difference on a Z80.
.



Relevant Pages

  • Re: multisets
    ... So if in a particular system, the numlist version is as slow as the findall ... not little - and so it does matter. ... radically different implementations for message queues between threads ... using pthread-win32 the Windows version was 100 times slower. ...
    (comp.lang.prolog)
  • Re: OBarrs comments on SR and LET.
    ... and independent absolute time? ... matter) in the direction of travel, and do all clocks physically run slower ... when we consider them moving relative to the absolute ether frame? ...
    (sci.physics.relativity)
  • I have already justified the Einsteins specific relativity
    ... In the theory of specific relativity, we face the matter that if we ... III - The time will go by slower for it. ... II- It's mass decreases. ...
    (sci.physics.relativity)
  • I have already justified the Einsteins specific relativity
    ... In the theory of specific relativity, we face the matter that if we ... III - The time will go by slower for it. ... II- It's mass decreases. ...
    (sci.physics)