Just a guess.  const means the value can't be changed, right?

So the function returning doesn't have to push Instring back onto
the stack, since it is known it couldn't of changed, that's probably
your time savings.

If I'm wrong I'm sure someone will correct me.

Regards,

Jim Langston

I thought I was wrong once, but I was mistaken.

-----Original Message-----
From: Steve Richter [mailto:srichter@autocoder.com]

here is a performance discrepancy that happens when a string arg is passed
"const varying" ( fast ) vs "value varying" ( slow ).

** arg1 is value varying.
 pTestFunc1        b
 dTestFunc1        pi            10a
 d InString                   32000a   value varying
 c                   return    'efg'
 p                 e

** arg1 is const varying.
 pTestFunc2        b
 dTestFunc2        pi            10a
 d InString                   32000a   const varying
 c                   return    'efg'
 p                 e

 d rv              s             10a
 d ch80            s             80a   varying

** runs slow. 9663 milliseconds to do 50,000 calls.
 c                   eval      rv = TestFunc1( ch80 )
 c                   eval      rv = TestFunc2( ch80 )

** runs fast. 73 milliseconds to do 50,000 calls.
 c                   eval      rv = TestFunc1( ch80 )
 c                   eval      rv = TestFunc2( ch80 )

why the speed difference?

Steve Richter


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.