ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcl-core
tcl-core
Re: [TCLCORE] [SPAM] [6.0] Re: base64 in the core?
by Larry McVoy other posts by this author
Apr 28 2008 7:36AM messages near this date
Re: [TCLCORE] [SPAM] [6.0] Re: base64 in the core? | Re: [TCLCORE] [SPAM] [6.0] Re: base64 in the core?
On Mon, Apr 28, 2008 at 02:37:03PM +0100, Donal K. Fellows wrote:
>  Kevin Kenny wrote:
>  > Uhm, Donal, excuse me?  This is a simple forward iteration. Keep an
>  > index into the string rep - as opposed to the 'string' internal rep.
>  > (That one never shimmers.)  On each trip through the loop, decode
>  > one UTF-8 character and advance the index around it.  There's no
>  > real slowdown because you don't need to get into quadratic behaviour
>  > counting the UTF-8 characters (the way a naively coded [string index]
>  > loop at Tcl level would).
>  > 
>  > If you want to cache single character strings (at least for
>  > ISO8849 characters), go for it.  But I suspect that in most uses
>  > of this, the single characters would be short-lived.
>  
>  Bah, this whole discussion is getting out of hand (and I'm highly
>  irritable today because I'm teaching). For the business of [string
>  foreach], I'd be perfectly happy to see an implementation as you
>  describe it. Since it's iterating by single characters, the benefit of
>  buffer sharing would be slight. Whether or not to cache character-objs
>  would be a question to decide at a later date.

Is it possible we're talking past each other?  I get the feeling you are
seeing a more complicated picture than I am.  I was thinking something
like what Kevin wrote.  The only thing that is complicated is that 
you have the source buffer having an extra reference count for the
duration of the loop.  The chars themselves are extracted one at a
time and stuck into another tcl obj that has no unusual ref counting.
So this approach should be, for long strings, much nicer than
using split.

I'm wondering if you thought I was asking for the reference count 
jiggering to be on both the char and the string so the char shared
the strings refcount or something.  If so, no, that's too wacky for
me.
-- 
---
Larry McVoy                lm at bitmover.com           http://www.bitkeeper.com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Tcl-Core mailing list
Tcl-Core@[...].net
https://lists.sourceforge.net/lists/listinfo/tcl-core
Thread:
Trevor Davel
Pat Thoyts
Kevin Kenny
Donal K. Fellows
Larry McVoy
Donal K. Fellows
Larry McVoy
Donal K. Fellows
Kevin Kenny
Donal K. Fellows
Larry McVoy
Donal K. Fellows
Alexandre Ferrieux
Lars Hellstrom
Donal K. Fellows
Alexandre Ferrieux
Donal K. Fellows
Alexandre Ferrieux
Donal K. Fellows
Alexandre Ferrieux
Larry McVoy

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved