MTIMER slows PB down 
Author Message
 MTIMER slows PB down

Hello!

Following Code slows powerbasic (3.2) down:

-CUT------------------------------------------------->
cls
D:
MTIMER     'To reset MTIMER-- This line slows PB down!
FOR E%=1 TO 100   'Pentium 233MHz with EMM386
NEXT E%
g=MTIMER
i%=i%+1
locate 1,1:print i%
GOTO D:
<-PASTE------------------------------------------------

This code is really slow.
By removing the marked line above, PowerBasic gets faster, but not as fast
as TurboBasic for e.G.
Do anyone have an advice for me?

Thanks,

Andreas



Mon, 15 Mar 2004 18:12:07 GMT  
 MTIMER slows PB down

Quote:
> Hello!

> Following Code slows PowerBasic (3.2) down:

> -CUT------------------------------------------------->
> cls
> D:
> MTIMER     'To reset MTIMER-- This line slows PB down!
> FOR E%=1 TO 100   'Pentium 233MHz with EMM386
> NEXT E%
> g=MTIMER
> i%=i%+1
> locate 1,1:print i%
> GOTO D:
> <-PASTE------------------------------------------------

> This code is really slow.
> By removing the marked line above, PowerBasic gets faster, but not as fast
> as TurboBasic for e.G.
> Do anyone have an advice for me?

What are you trying to do?  Induce a delay?  Time some other piece of code
you are not showing us? Rapidly print the numbers 1 to infinity (or whenever
you press control-break) at the home position of the screen? Or, as coded,
exactly nothing useful?

MTIMER is not the correct method to control execution speed. It is meant to
be used to, well, TIME a single operation. Note that as per the help file,
the value returned by the MTIMER function is the time since the last MTIMER
statement; ; besides, since you are never doing anything with the value 'g'
returned by the function, you are not even using the function.

Trivial programs like this are NOT good performance benchmarks at all. If
you have some code which is not performing as well as you think it should,
explain what you are doing, post the relevant code and ask for assistance.

--
Michael C. Mattias
Tal Systems Inc.
Racine WI



Mon, 15 Mar 2004 19:07:44 GMT  
 MTIMER slows PB down
On Thu, 27 Sep 2001 12:12:07 +0200, "Andreas Eckert"

Quote:

>Hello!

>Following Code slows PowerBasic (3.2) down:

>-CUT------------------------------------------------->
>cls
>D:
>MTIMER     'To reset MTIMER-- This line slows PB down!
>FOR E%=1 TO 100   'Pentium 233MHz with EMM386
>NEXT E%
>g=MTIMER
>i%=i%+1
>locate 1,1:print i%
>GOTO D:
><-PASTE------------------------------------------------

>This code is really slow.
>By removing the marked line above, PowerBasic gets faster, but not as fast
>as TurboBasic for e.G.
>Do anyone have an advice for me?

>Thanks,

>Andreas

Andreas,

the MTIMER statement apparently waits to sync up with some system
counter before it returns to the caller. The sync rate seems to be
about 22 Hz, running under a dos box in win98.

I've noticed before that doing MTIMER operations will greatly slow
program execution, so it's only useful for testing, but generally not
good in a 'production' program.

try

   FOR X = 1 TO 1000
       MTIMER
       PRINT X
   NEXT

which is darned slow.

John



Wed, 17 Mar 2004 08:54:59 GMT  
 MTIMER slows PB down
Are you saying that it does nothing slowly?  8-)

Please refer to the post in this thread by Mr Mattias... it explains
things pretty well.


Quote:
>try

>   FOR X = 1 TO 1000
>       MTIMER
>       PRINT X
>   NEXT

>which is darned slow.

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Wed, 17 Mar 2004 23:30:24 GMT  
 MTIMER slows PB down

Quote:

>Are you saying that it does nothing slowly?  8-)

>Please refer to the post in this thread by Mr Mattias... it explains
>things pretty well.

Excuse me, but Mr Mattias' post merely criticized the OP and really
explained nothing at all. If Mr M knows how the MTIMER operations
really work, I'd appreciate his telling us.

Agreed, my code snip, like the OP's, does nothing useful except
demonstrate that MTIMER use greatly slows program execution.

John



Fri, 19 Mar 2004 01:26:30 GMT  
 MTIMER slows PB down

Quote:


> >Are you saying that it does nothing slowly?  8-)

> >Please refer to the post in this thread by Mr Mattias... it explains
> >things pretty well.

> Excuse me, but Mr Mattias' post merely criticized the OP and really
> explained nothing at all. If Mr M knows how the MTIMER operations
> really work, I'd appreciate his telling us.

No, Mr. Mattias' post did not criticize the OP (of this I'm sure, because he
does not have a clue what you mean by "OP")  and explained something VERY
important: when you ask for help, you should explain what it is which with
you want help. He also explained MTIMER is not your best choice of functions
to control timed operations.

It "appeared" from the post you were trying to construct some kind of b{*filter*}
timing operation. Apparently, you were not interested in timing anything;
rather, you were just interested in the internal operation of the MTIMER
verb itself. I don't understand why, but I don't understand why some guys
enjoy kiddie {*filter*}, either.

Internal operation of the MTIMER verb? No clue and no interest.

MCM



Fri, 19 Mar 2004 05:45:11 GMT  
 MTIMER slows PB down
Mike,

OP is commonly used to mean Original Poster, namely the guy who
started the thread. And you did rag him some.

I've had situations where it would have been very handy to use the
MTIMER sequence in an actual application, but couldn't because of this
apparent synchronizing delay.

John



Fri, 19 Mar 2004 08:06:24 GMT  
 MTIMER slows PB down

Quote:
> Mike,

> OP is commonly used to mean Original Poster, namely the guy who
> started the thread. And you did rag him some.

> I've had situations where it would have been very handy to use the
> MTIMER sequence in an actual application, but couldn't because of this
> apparent synchronizing delay.

> John

Ok, so I may have been a little {*filter*} him. I acknowledge I have little
patience for divining what some people are really asking; and little or no
tolerance for those who "want to do [something], but only if I can do it my
way."  I am a practical programmer; instead of asking, "how/where can I use
this verb/function?" I look at things the other way: "I want to accomplish
[something]. Which verb/function shall I use?"

That said, let's re-examine the original post:

Quote:
>Hello!
>Following Code slows PowerBasic (3.2) down:
>-CUT------------------------------------------------->
>[balance snipped]

New answer:

Then, if speed in this program is important, don't use that code.

MCM



Fri, 19 Mar 2004 19:30:27 GMT  
 MTIMER slows PB down
On Mon, 01 Oct 2001 11:30:27 GMT, "Michael Mattias"

Quote:



>> Mike,

>> OP is commonly used to mean Original Poster, namely the guy who
>> started the thread. And you did rag him some.

>> I've had situations where it would have been very handy to use the
>> MTIMER sequence in an actual application, but couldn't because of this
>> apparent synchronizing delay.

>> John

>Ok, so I may have been a little {*filter*} him. I acknowledge I have little
>patience for divining what some people are really asking; and little or no
>tolerance for those who "want to do [something], but only if I can do it my
>way."  I am a practical programmer; instead of asking, "how/where can I use
>this verb/function?" I look at things the other way: "I want to accomplish
>[something]. Which verb/function shall I use?"

>That said, let's re-examine the original post:

>>Hello!
>>Following Code slows PowerBasic (3.2) down:
>>-CUT------------------------------------------------->
>>[balance snipped]

>New answer:

>Then, if speed in this program is important, don't use that code.

>MCM

Ah, that makes it clear: you don't know how MTIMER works, and you
don't care. Can't argue with an attitude like that!

John



Sat, 20 Mar 2004 13:04:19 GMT  
 MTIMER slows PB down
John,

I would say that Michael Mattias, Lance Edmonds,  and Dave Navarro are the
sanest voices in the PowerBasic world.  If you don't agree with these people
then you are in deep trouble.

You'll find that the further up you go,  the more the lines of communication
close...after all, you are putting down Bob Zales' creation,  and he is god
after all.  Believe me,  and I have experience in this,  if you think going
any higher will get you satisfaction,  think again.

Dan



Sun, 21 Mar 2004 13:55:09 GMT  
 MTIMER slows PB down



Quote:
> I would say that Michael Mattias, Lance Edmonds,  and Dave Navarro are the
> sanest voices in the PowerBasic world.

   Probably not too hard to agree upon that.

Quote:
>If you don't agree with these people
> then you are in deep trouble.

 Yeah, just as in the former USSR during the Stalin period.

Quote:
> and he is god after all.

Surely there are many gods among men on the earth.
But above them all there is only one living God of truth and life.

Some claims that Allah too is a god.
But he who says "I am the way, the truth and the life", well who cares about
him?
Not any of them important people out there anyway.



Sun, 21 Mar 2004 22:10:13 GMT  
 MTIMER slows PB down


Quote:
>John,

>I would say that Michael Mattias, Lance Edmonds,  and Dave Navarro are the
>sanest voices in the PowerBasic world.  If you don't agree with these people
>then you are in deep trouble.

>You'll find that the further up you go,  the more the lines of communication
>close...after all, you are putting down Bob Zales' creation,  and he is god
>after all.  Believe me,  and I have experience in this,  if you think going
>any higher will get you satisfaction,  think again.

>Dan

Dan,

you are indeed on-target. The logic is thus: anyone who uses
PowerBasic must be an idiot, and the function of the Pros is to remind
us of that whenever we dare to ask impertinent questions (like: how
does *that* actually work?).

Reminds me of Groucho's line about how he wouldn't join any club that
would be willing to accept him as a member.

So, if PowerBasic is so good, how come the PowerBasic compilers aren't
written in PowerBasic?

John

who is grateful that Bill Gates doesn't have time to insult him
personally.



Sun, 21 Mar 2004 22:28:45 GMT  
 MTIMER slows PB down

Quote:


>So, if PowerBasic is so good, how come the PowerBasic compilers aren't
>written in PowerBasic?

Not that this is relevent at all to this topic of discussion, but the
fact is that all PowerBASIC compilers are written in hand-optimized
assembler for absolute compilation performance.  

Also, Inline-assembler functionality is provided by all PowerBASIC
compilers to all PowerBASIC programmers too!   ;-)

Further, the PB/CC and PB/DLL IDE's are written in 100% pure
PowerBASIC, as is the PBRES compiler, PowerGEN, PowerTREE and a host
of other tools and utilities are written in 100% pure PowerBASIC code.

8-)

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Mon, 22 Mar 2004 08:44:32 GMT  
 MTIMER slows PB down
MTIMER is designed to accurately measure the elapsed time for a single event,
not to be used repeatedly.  Frankly, there is no point in using it the way you
did, since it measures the elapsed time from execution of an MTIMER statement
until the next MTIMER function.  An example might be to measure the
comparative speed of writing some code 2 or 3 different ways.

In order to be as accurate as possible, it avoids time measurement over the
system timer tick, which occurs every 54 msec.  When an MTIMER statement is
executed, execution is paused until the next tick occurs, which guarantees us
54 msec of uninterrupted elapsed time until the next tick occurs.  Simply a
way to help improve the accuracy by avoiding unnecessary interrupts.

Regards,

Bob Zale
PowerBASIC Inc.



Wed, 24 Mar 2004 04:06:25 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. vw2.5 sometimes slows down when large

2. global floating windows slow down graphics?

3. Slow down utility ???

4. Super security slows down

5. Topspeed DB - Record Filter slow down ?!?

6. Slowing down/freezing until user interrupt & proceed

7. Bizzare slowing down in forms ...

8. Report process slow down when...

9. program slows down

10. Citrix time() slow down.

11. program slows down

12. Record Filter slows down Browse Window ???

 

 
Powered by phpBB® Forum Software