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 27 2008 4:40PM 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 12:07:24AM +0100, Donal K. Fellows wrote:
>  Larry McVoy wrote:
>  >If you don't return but one char at a time, isn't it cheaper?
>  
>  Maybe. I'd be interested in seeing real measurements. (I only know what
>  I did to [split] was a win because I measured it.)

I'm a big fan of measurements.  See http://bitmover.com/lm/langbench.shar :)

>  >Shouldn't that just maintain a reference on buf throughout the loop (so
>  >noone can change it) and internally, in the state for the foreach,
>  >maintain an index into buf?  Module unicode char widths, etc.
>  >
>  >It seems to me that is mucho cheaper than internally splitting it into
>  >a bunch of char objects.  Just use one.  Would that not work?
>  
>  Theoretically yes, but you're spreading a lot of complexity to handle
>  these indexed (and reference-counted) strings properly. 

Can you explain that a bit?  I'm thinking something like

    when we detect a foreach (c in buf) 
	bump the refcount on buf
	set an index at 0
	start the loop
	each iteration
		c = buf[index++]
		loop body
		decr refcount on c
        decr refcount on buf

What's so hard about that?  I realize I'm asking this naively so I'm not
say "you wuss, go do it", I'm say "teach me why this is hard, please".
-- 
---
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