www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Proposal - clear() method for OutBuffer

reply Dave <Dave_member pathlink.com> writes:
Say you're using an OutBuffer to construct a key for an AA. Right now you either
have to new an OutBuffer for each key, or you can use public access to the data
members to clear it, like this:










(The point is not the contrived example. The point is being able to format a
string buffer in a code and runtime efficient way.)

How about if OutBuffer.data and OutBuffer.offset are given private access, and a
clear() method is added to OutBuffer that does the same as above?

Perhaps there is a more efficient method, but the above is 4-6x faster than
new'ing an OutBuffer for each loop depending on how often the loop is run.

Thanks,

- Dave
Aug 29 2004
parent reply Dave <Dave_member pathlink.com> writes:
Hmmm, "given private access" below should most likely be "given protected
access".

I haven't had a chance to follow the 3rd Party Phobos threads as closely as
I'd like and I don't know if there is even a consensus yet.. Is there now a
better place to post/discuss library related issues?

Thanks,

- Dave

Dave wrote:

 
 Say you're using an OutBuffer to construct a key for an AA. Right now you
 either have to new an OutBuffer for each key, or you can use public access
 to the data members to clear it, like this:
 








 
 (The point is not the contrived example. The point is being able to format
 a string buffer in a code and runtime efficient way.)
 
 How about if OutBuffer.data and OutBuffer.offset are given private access,
 and a clear() method is added to OutBuffer that does the same as above?
 
 Perhaps there is a more efficient method, but the above is 4-6x faster
 than new'ing an OutBuffer for each loop depending on how often the loop is
 run.
 
 Thanks,
 
 - Dave
Aug 30 2004
next sibling parent J C Calvarese <jcc7 cox.net> writes:
Dave wrote:
 Hmmm, "given private access" below should most likely be "given protected
 access".
 
 I haven't had a chance to follow the 3rd Party Phobos threads as closely as
If your referring to the DSLG/Deimos Rising/Phobos Rising discussion, it's still alive and pretty much on track. It's moved over to a forum at dsource, though: http://www.dsource.org/forums/viewforum.php?f=31
 I'd like and I don't know if there is even a consensus yet.. Is there now a
 better place to post/discuss library related issues?
This newsgroup is probably still the best place to bring these criticisms up. Walter's still the one who produces those nifty archives with the compiler (and it'll probably be that way forever), and the "Phobos Rising" discussion is still trying to answer fundamental questions like "Who are we?" and "Why are we here?".
 
 Thanks,
 
 - Dave
 
 Dave wrote:
 
 
Say you're using an OutBuffer to construct a key for an AA. Right now you
either have to new an OutBuffer for each key, or you can use public access
to the data members to clear it, like this:










(The point is not the contrived example. The point is being able to format
a string buffer in a code and runtime efficient way.)

How about if OutBuffer.data and OutBuffer.offset are given private access,
and a clear() method is added to OutBuffer that does the same as above?

Perhaps there is a more efficient method, but the above is 4-6x faster
than new'ing an OutBuffer for each loop depending on how often the loop is
run.

Thanks,

- Dave
-- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Aug 31 2004
prev sibling parent Dave <Dave_member pathlink.com> writes:
Anyone have any comments on the "clear()" method for OutBuffer?

Any code out there that relies on public access to OutBuffer.data and/or
OutBuffer.offset?

For the current library, there is one line in std/regexp.d (setting data = null)
that would need to be changed if the following was changed in std/outbuffer.d:

#class OutBuffer



#protected:


#public:







Thanks,

- Dave

In article <cgvf7n$2h74$1 digitaldaemon.com>, Dave says...
Hmmm, "given private access" below should most likely be "given protected
access".

I haven't had a chance to follow the 3rd Party Phobos threads as closely as
I'd like and I don't know if there is even a consensus yet.. Is there now a
better place to post/discuss library related issues?

Thanks,

- Dave

Dave wrote:

 
 Say you're using an OutBuffer to construct a key for an AA. Right now you
 either have to new an OutBuffer for each key, or you can use public access
 to the data members to clear it, like this:
 








 
 (The point is not the contrived example. The point is being able to format
 a string buffer in a code and runtime efficient way.)
 
 How about if OutBuffer.data and OutBuffer.offset are given private access,
 and a clear() method is added to OutBuffer that does the same as above?
 
 Perhaps there is a more efficient method, but the above is 4-6x faster
 than new'ing an OutBuffer for each loop depending on how often the loop is
 run.
 
 Thanks,
 
 - Dave
Sep 01 2004