realbasic-nug
[Top] [All Lists]

Re: High Performance Code (Was: Bitwise Shift operators)

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: High Performance Code (Was: Bitwise Shift operators)
From: Frank Condello <developer at chaoticbox dot com>
Date: Sat, 29 Sep 2007 15:16:50 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <BAY107-DAV2744FC1F92F91EEB3D2A593B30 at phx dot gbl>
On 29-Sep-07, at 2:37 PM, Daniel Stenning wrote:

> Talking of which, one bit of tedium I find myself having to do a  
> lot of
> these days is assigning a memoryblock reference to a Ptr variable,  
> in order
> that I can do high performance processing on memoryblocks. It makes  
> a hell
> of a difference to use the Ptr dereferencing syntax instead of the
> memoryblock methods.  I really wish there were a built in property  
> that just
> always gave us the pointer to the memoryblock.  I have wrapper  
> "buffer"
> class that does just this, but I still wish it were automatically  
> built in.

Any built-in Ptr property would have to be read-only and computed on  
every access since the address can and will change if the block is  
resized. For the sake of speed it's probably best to live with a  
subclass that exposes an "Address As Ptr" property that's assigned in  
overloaded Constructor and Size methods. Then just be careful to  
always access that directly, and never write to or cache it elsewhere.

Frank.
<http://developer.chaoticbox.com/>



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>