[Seaside] i10n or speed?

Dominic Letz dominic.letz at berlin.de
Mon Mar 19 14:49:42 UTC 2007


I already wrote a squeak plugin which implements this call (only ascii
chars) as an primitive. It is available compiled as dll for windows on: 
http://monticello.dominicletz.de/fcgi/SeasidePlugin.dll
the bindings and the plugin source are in: 
http://monticello.dominicletz.de/fcgi/SeasidePlugin-dl.1.mcz

This works very well for me and has removed that entry complete from my
message tallies

On Mon, 19 Mar 2007 13:44:35 +0100, Bert Freudenberg
<bert at freudenbergs.de> wrote:

> 
> On Mar 19, 2007, at 13:34 , Philippe Marschall wrote:
> 
> > 2007/3/19, Bert Freudenberg <bert at freudenbergs.de>:
> >>
> >> On Mar 19, 2007, at 12:58 , Philippe Marschall wrote:
> >>
> >> > 2007/3/19, Bert Freudenberg <bert at freudenbergs.de>:
> >> >>
> >> >> On Mar 19, 2007, at 11:58 , Philippe Marschall wrote:
> >> >>
> >> >> > encodeForHTTP.
> >> >> >
> >> >> > So what do you find more important, that Seaside is fast or  
> >> that is
> >> >> > supports non-ascii urls?
> >> >>
> >> >> I'm pretty sure you could have your cake and eat it, too, if you
> >> >> rewrite that method
> >> >
> >> > We don't do overrides anymore.
> >> >
> >> >> using #indexOfAnyOf: and CharacterSets, which are
> >> >> very fast.
> >> >
> >> > You would do this as a replacement for #isSafeForHTTP? Why not  
> >> just a
> >> > boolean Array and lookup by #charCode?
> >>
> >> Because it's much faster?
> >
> > A lookup in a boolean Array would be
> > - a bit and for #charCode
> > - an small integer comparison for <
> > - #at: on an array
> > how much faster can you get?
> 
> A single primitive invocation for the whole string.
> 
> >> > Do you see any optimization potential in
> >> > #encodeForHTTPWithTextEncoding:conditionBlock: ?
> >>
> >> If I'd see the code, probably.
> >
> > encodeForHTTPWithTextEncoding: encodingName conditionBlock:  
> > conditionBlock
> >       "change dangerous characters to their %XX form, for use in HTTP 
> > transactions"
> >
> >       | httpSafeStream encodedStream cont |
> >       httpSafeStream _ WriteStream on: (String new).
> >       encodedStream _ MultiByteBinaryOrTextStream on: (String new: 6).
> >       encodedStream converter: (TextConverter newForEncoding:  
> > encodingName).
> >       self do: [:c |
> >               (conditionBlock value: c)
> >                       ifTrue: [httpSafeStream nextPut: (Character
> >                       value: c charCode)] ifFalse: [
> >                               encodedStream text; reset.
> >                               encodedStream nextPut: c.
> >                               encodedStream position: 0.
> >                               encodedStream binary.
> >                               cont _ encodedStream contents.
> >                               cont do: [:byte |
> >                                       httpSafeStream nextPut: $%.
> >                                       httpSafeStream nextPut: (byte //
> >                                       16) asHexDigit.
> >                                       httpSafeStream nextPut: (byte \\
> >                                       16) asHexDigit.
> >                               ].
> >                       ].
> >       ].
> >       ^ httpSafeStream contents.
> 
> Yep. The whole thing could be avoided for ASCII strings with a single  
> #indexOfAnyOf: test. This would solve your original question, because  
> as long as you do not use non-ASCII characters it would be fast.
> 
> - Bert -
> 
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list