[Seaside] i10n or speed?

Philippe Marschall philippe.marschall at gmail.com
Mon Mar 19 14:56:33 UTC 2007


2007/3/19, Bert Freudenberg <bert at freudenbergs.de>:
>
> 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.

I owe you one, Pier just went from 8.74 request/sec to 19.24 request/sec.

Philippe

> - 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