Re: Rob: Q: Constant Scope

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jason Gade wrote:
> copied from Rob Craig's post (a few years ago):
>     There's an optimization which is near the top of my list, that would
>      eliminate the need for copy-on-write in many cases. Consider:
> 
>                function sort(sequence s)
> 
>                    s[i] = ...
>  
>               end function
> 
>                sequence x
>                ...
>                x = {5,6,7,8}
>                ...
>                x = sort(x)
> 
>      It would be possible to detect that the value of x, as passed to
>      sort(), will never be needed again. The implementation could then
>      arrange that the value passed to sort() will have only *one* 
>      reference count (from s), rather than 2 (from x and s). This would 
>      eliminate the need for a copy.
> 
> I think that this is a very reasonable optimization that eliminates most 
> of the arguments for modifying "pass by reference" values.  Have you 
> ever implemented it?

No I haven't, but it's still near the top of my list.

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu