1. Comparison of ex.exe and exw.exe

Hi all,

This is a report and some questions...

I ran the following program first as a .ex file and then as a .exw file:

--with trace
integer fn
atom ctr,t,tt
sequence powersOfTwo


procedure PowersOfTwo(integer maxPower) 
	--set up sequence of the powers of two
	powersOfTwo={}
	for i = maxPower to 0 by -1 do
		powersOfTwo&=power(2,i)
	end for
end procedure


fn=open("c:\\euphoria\\test.txt","a")
printf(fn,"%s",{"--------------------------\n"})
printf(fn,"%s",{"Program run as an .ex file\n"})
printf(fn,"%s",{"--------------------------\n"})

for i=1 to 10 do
	ctr=0
	tt=0
	t=time()
	while tt<10 do
		PowersOfTwo(15)
		ctr+=1
		if time()-t>=1 then
			tt+=time()-t
			t=time()
		end if
		--task_yield()
	end while
	
	printf(1,"Without task_yield() - Counter= %d\n",ctr)
	printf(fn,"Without task_yield() - Counter= %d\n",ctr)		
	
	ctr=0
	tt=0
	t=time()
	while tt<10 do
		PowersOfTwo(15)
		ctr+=1
		if time()-t>=1 then
			tt+=time()-t
			t=time()
		end if
		task_yield()
	end while
	
	printf(1,"With task_yield() Counter= %d\n",ctr)
	printf(fn,"With task_yield() Counter= %d\n",ctr)		
end for

puts(1, "Done\n")
close(fn)


The results were these:

--------------------------
Program run as an .ex file
--------------------------
Without task_yield() - Counter= 8907
With task_yield() Counter= 6990
Without task_yield() - Counter= 12522
With task_yield() Counter= 6990
Without task_yield() - Counter= 12922
With task_yield() Counter= 9974
Without task_yield() - Counter= 18442
With task_yield() Counter= 6926
Without task_yield() - Counter= 13146
With task_yield() Counter= 7006
Without task_yield() - Counter= 18282
With task_yield() Counter= 8606
Without task_yield() - Counter= 18522
With task_yield() Counter= 9822
Without task_yield() - Counter= 13114
With task_yield() Counter= 6942
Without task_yield() - Counter= 12906
With task_yield() Counter= 6998
Without task_yield() - Counter= 12522
With task_yield() Counter= 9790
--------------------------
Program run as an .exw file
--------------------------
Without task_yield() - Counter= 6506820
With task_yield() Counter= 5603225
Without task_yield() - Counter= 6627387
With task_yield() Counter= 5908716
Without task_yield() - Counter= 6681521
With task_yield() Counter= 5955933
Without task_yield() - Counter= 6763471
With task_yield() Counter= 5927231
Without task_yield() - Counter= 6704800
With task_yield() Counter= 5944609
Without task_yield() - Counter= 6680652
With task_yield() Counter= 5874263
Without task_yield() - Counter= 6798967
With task_yield() Counter= 5994632
Without task_yield() - Counter= 6796827
With task_yield() Counter= 5920769
Without task_yield() - Counter= 6732716
With task_yield() Counter= 5992335
Without task_yield() - Counter= 6808662
With task_yield() Counter= 5996697
----------------

I was looking in to the task_yield() command to see what difference it made
and trying to begin to understand how Windows deals with its tasks, i.e. how
to get a program to "play nice".

The results are amazing in their difference in speed!  The .exw file ran
around 500 times faster.  The proportional difference in the task_yield() 
command is different too.

So, is this what you would have expected to have been the result?  Can I
modify the properties of ex.exe to increase the speed?

Also, there was a quite different effect in Process Manager (similar to 
Task Manager) as to the use of the CPU.  With ex.exe, the System Idle Process
was around 94 to 98% all the time.  When exw.exe ran it took the place of
System Idle Process and used nearly all the resources.  So, is that the
normal way of things?  Any way to modify that -- "nice" it?  I ask because
I do run some programs that slow to a crawl with exw.exe running (especially
an old copy of MS Word when it saves a file).

Still learning about tasks...

--Quark

new topic     » topic index » view message » categorize

2. Re: Comparison of ex.exe and exw.exe

DB James wrote:
> I ran the following program first as a .ex file and then as a .exw file:
> 
> }}}
<eucode>
> --with trace
> integer fn
> atom ctr,t,tt
> sequence powersOfTwo
> 
> 
> procedure PowersOfTwo(integer maxPower) 
> 	--set up sequence of the powers of two
> 	powersOfTwo={}
> 	for i = maxPower to 0 by -1 do
> 		powersOfTwo&=power(2,i)
> 	end for
> end procedure
> 
> 
> fn=open("c:\\euphoria\\test.txt","a")
> printf(fn,"%s",{"--------------------------\n"})
> printf(fn,"%s",{"Program run as an .ex file\n"})
> printf(fn,"%s",{"--------------------------\n"})
> 
> for i=1 to 10 do
> 	ctr=0
> 	tt=0
> 	t=time()
> 	while tt<10 do
> 		PowersOfTwo(15)
> 		ctr+=1
> 		if time()-t>=1 then
> 			tt+=time()-t
> 			t=time()
> 		end if
> 		--task_yield()
> 	end while
> 	
> 	printf(1,"Without task_yield() - Counter= %d\n",ctr)
> 	printf(fn,"Without task_yield() - Counter= %d\n",ctr)		
> 	
> 	ctr=0
> 	tt=0
> 	t=time()
> 	while tt<10 do
> 		PowersOfTwo(15)
> 		ctr+=1
> 		if time()-t>=1 then
> 			tt+=time()-t
> 			t=time()
> 		end if
> 		task_yield()
> 	end while
> 	
> 	printf(1,"With task_yield() Counter= %d\n",ctr)
> 	printf(fn,"With task_yield() Counter= %d\n",ctr)		
> end for
> 
> puts(1, "Done\n")
> close(fn)
> </eucode>
{{{

> 
> The results were these:
> 
> --------------------------
> Program run as an .ex file
> --------------------------
> Without task_yield() - Counter= 8907
> With task_yield() Counter= 6990
> Without task_yield() - Counter= 12522
> With task_yield() Counter= 6990
> Without task_yield() - Counter= 12922
> With task_yield() Counter= 9974
> Without task_yield() - Counter= 18442
> With task_yield() Counter= 6926
> Without task_yield() - Counter= 13146
> With task_yield() Counter= 7006
> Without task_yield() - Counter= 18282
> With task_yield() Counter= 8606
> Without task_yield() - Counter= 18522
> With task_yield() Counter= 9822
> Without task_yield() - Counter= 13114
> With task_yield() Counter= 6942
> Without task_yield() - Counter= 12906
> With task_yield() Counter= 6998
> Without task_yield() - Counter= 12522
> With task_yield() Counter= 9790
> --------------------------
> Program run as an .exw file
> --------------------------
> Without task_yield() - Counter= 6506820
> With task_yield() Counter= 5603225
> Without task_yield() - Counter= 6627387
> With task_yield() Counter= 5908716
> Without task_yield() - Counter= 6681521
> With task_yield() Counter= 5955933
> Without task_yield() - Counter= 6763471
> With task_yield() Counter= 5927231
> Without task_yield() - Counter= 6704800
> With task_yield() Counter= 5944609
> Without task_yield() - Counter= 6680652
> With task_yield() Counter= 5874263
> Without task_yield() - Counter= 6798967
> With task_yield() Counter= 5994632
> Without task_yield() - Counter= 6796827
> With task_yield() Counter= 5920769
> Without task_yield() - Counter= 6732716
> With task_yield() Counter= 5992335
> Without task_yield() - Counter= 6808662
> With task_yield() Counter= 5996697
> ----------------
> 
> I was looking in to the task_yield() command to see what difference it made
> and trying to begin to understand how Windows deals with its tasks, i.e. how
> to get a program to "play nice".
> 
> The results are amazing in their difference in speed!  The .exw file ran
> around 500 times faster.  The proportional difference in the task_yield() 
> command is different too.

We found a while back that the time() function, which is also used
inside task_yield(), is much faster on Windows than on DOS.

> So, is this what you would have expected to have been the result?  Can I
> modify the properties of ex.exe to increase the speed?
> 
> Also, there was a quite different effect in Process Manager (similar to 
> Task Manager) as to the use of the CPU.  With ex.exe, the System Idle Process
> was around 94 to 98% all the time.  When exw.exe ran it took the place of
> System Idle Process and used nearly all the resources.  So, is that the
> normal way of things?  Any way to modify that -- "nice" it?  I ask because
> I do run some programs that slow to a crawl with exw.exe running (especially
> an old copy of MS Word when it saves a file).
> 
> Still learning about tasks...

I don't think this has much to do with tasks, other
than the fact that task_yield() makes one call to ask
the system for the time.

> ...
> So, just because it ran in a Full Screen mode, it is a whole bunch faster?

I know that Windows runs DOS programs in some strange emulation mode
that behaves differently depending on full-screen vs. 
window. I don't really understand it. Another oddity that I came
across was with the task_sort.ex demo. Run it, then start
sliding your mouse back and forth. When your mouse is moving,
the program runs much faster (and the program itself
makes no use of the mouse).

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Comparison of ex.exe and exw.exe

Robert Craig wrote:
> 
> DB James wrote:
> > I ran the following program first as a .ex file and then as a .exw file:
> > 
<SNIP>
> > 
> > The results were these:
> > 
> > --------------------------
> > Program run as an .ex file
> > --------------------------
> > Without task_yield() - Counter= 8907
> > With task_yield() Counter= 6990
> > Without task_yield() - Counter= 12522
> > With task_yield() Counter= 6990
<SNIP>
> > --------------------------
> > Program run as an .exw file
> > --------------------------
> > Without task_yield() - Counter= 6506820
> > With task_yield() Counter= 5603225
> > Without task_yield() - Counter= 6627387
> > With task_yield() Counter= 5908716
<SNIP>
> > The results are amazing in their difference in speed!  The .exw file ran
> > around 500 times faster.  The proportional difference in the task_yield() 
> > command is different too.
> 
> We found a while back that the time() function, which is also used
> inside task_yield(), is much faster on Windows than on DOS.
> 
<SNIP>
> > So, just because it ran in a Full Screen mode, it is a whole bunch faster?
> 
> I know that Windows runs DOS programs in some strange emulation mode
> that behaves differently depending on full-screen vs. 
> window. I don't really understand it. Another oddity that I came
> across was with the task_sort.ex demo. Run it, then start
> sliding your mouse back and forth. When your mouse is moving,
> the program runs much faster (and the program itself
> makes no use of the mouse).
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

Hello,

Thanks for the clarification, though I'm still unsure about this:
When you say: "We found a while back that the time() function, which is also
used inside task_yield(), is much faster on Windows than on DOS." -- did
you accept the test results?  That is, does the astounding difference in
speed actually derive solely or primarily from the way Windows handles the
time() function, or is there something spurious in the test results?

Otherwise, I am going to muddle on and try to figure a way to deal with the
not particularly elegant-seeming way Windows handles its time allocation.

--Quark

new topic     » goto parent     » topic index » view message » categorize

4. Re: Comparison of ex.exe and exw.exe

DB James wrote:
> Thanks for the clarification, though I'm still unsure about this:
> When you say: "We found a while back that the time() function, which is also
> used inside task_yield(), is much faster on Windows than on DOS." -- did
> you accept the test results?  That is, does the astounding difference in
> speed actually derive solely or primarily from the way Windows handles the
> time() function, or is there something spurious in the test results?

Yes, it all has to do with time(). 
Your results make sense.
Try this, using ex, exw, exwc:

atom t
integer i
t = time()
i = 0
while time() < t+10 do
    i += 1
end while   
printf(1, "i is %d\n", i)
?getc(0)


I get exw and exwc running this almost 2000x faster than ex!
However, when I run it with ex, and slide my mouse back and forth
continuously, then ex speeds up by a factor of 50!

I get the impression that Windows gives very low
priority to ex when it asks for the time, but otherwise
there is not much difference between ex and exw. 
For instance, try this:

atom t
t = time()

for i = 1 to 1000000000 do
end for

printf(1, "%.2f\n", time()-t)
?getc(0)


I get ex as being slightly (10%) faster on this than exw or exwc.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: Comparison of ex.exe and exw.exe

Robert Craig wrote:
> 
> DB James wrote:
<SNIP>
> 
> Yes, it all has to do with time(). 
> Your results make sense.
> Try this, using ex, exw, exwc:
> 
> }}}
<eucode>
> atom t
> integer i
> t = time()
> i = 0
> while time() < t+10 do
>     i += 1
> end while   
> printf(1, "i is %d\n", i)
> ?getc(0)
> </eucode>
{{{

> 
> I get exw and exwc running this almost 2000x faster than ex!
> However, when I run it with ex, and slide my mouse back and forth
> continuously, then ex speeds up by a factor of 50!
> 
> I get the impression that Windows gives very low
> priority to ex when it asks for the time, but otherwise
> there is not much difference between ex and exw. 

<SNIP>
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

Hi,

Well, I did try it, then modified your code above to get a printout:
ex speed test not moving mouse
i is 108287
ex speed test while moving mouse
i is 1168715
Mouse-moving with ex.exe is 10 x faster
ex speed test not moving mouse
i is 139071
ex speed test while moving mouse
i is 1197511
Mouse-moving with ex.exe is 8 x faster

There certainly is a difference in speed with mouse movement, but I didn
not get the higher results you got -- mine were around 8 to 10 times faster.
It is as if Windows' attention were grabbed by the mouse and a lot gets
 done before the attention drifts away.

I found that both exwc and exw ran similarly and much faster, as you did,
though on my machine the differences were around 500 times faster.

On Vista there is a feature called System Resource Manager previously only
on server OS.  It seems to allow a control of how much cpu time will
be given to what programs.  Whatever, I'll be using XP for awhile yet...

Thanks for the effort to clarify all this.

--Quark

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu