× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



When something is passed "const" the system passes a pointer to the
data...  i.e. it has to copy 16 bytes.   (Unless, you pass an expression
or something like that, in which case it has to allocate memory, put
the value of the expression into that memory...  but it still passes
only the address of the temp memory)

However, when something is passed "value" it has to make a copy of the
entire variable.

So, logically, it will take longer to pass something large by value
than it would by const.   i.e. copyying 16 bytes is faster than copying
32,000.



On Tue, 8 Oct 2002, Steve Richter wrote:

> 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-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2024 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.