<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"><pre class="tw-data-text tw-text-large XcVN5d tw-ta" data-placeholder="Translation" id="tw-target-text" dir="ltr" style="font-family: inherit; font-size: 24px; line-height: 28px; border: none; padding: 10px 0.14em 10px 0px; position: relative; margin-top: -10px; margin-bottom: -10px; resize: none; overflow: hidden; width: 343px; word-wrap: break-word; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); color: rgb(32, 33, 36) !important;"><span class="Y2IQFc" lang="en">please don't send me more letters !!!</span></pre></div><div dir="ltr"><br><blockquote type="cite">On 2021-07-09, at 18:10, Levente Uzonyi <leves@caesar.elte.hu> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>Hi Christoph,</span><br><span></span><br><span>On Thu, 8 Jul 2021, christoph.thiede@student.hpi.uni-potsdam.de wrote:</span><br><span></span><br><blockquote type="cite"><span>Hi Levente,</span><br></blockquote><blockquote type="cite"><span>two very fair points, thank you for the feedback! Revisiting #escapeString: again, we do not even need to compile a new regex, which is really expensive, but we can use a simple loop instead:</span><br></blockquote><span></span><br><span>I thought you deliberately wanted to use regular expressions there.</span><br><span></span><br><blockquote type="cite"><span>    | special |</span><br></blockquote><blockquote type="cite"><span>    special := self specialCharacters.</span><br></blockquote><blockquote type="cite"><span>    ^ String streamContents: [:stream |</span><br></blockquote><blockquote type="cite"><span>        aString do: [:char |</span><br></blockquote><blockquote type="cite"><span>            (special includes: char) ifTrue: [stream nextPut: $\].</span><br></blockquote><blockquote type="cite"><span>            stream nextPut: char]]</span><br></blockquote><blockquote type="cite"><span>Which is 90% faster than the original approach. :-)</span><br></blockquote><span></span><br><span>If you want the "Best Performance (tm)", there is a Squeak-specific pattern for these kinds of string-rewrite methods, which consists of a precomputed character set and the use of #new:streamContents:, #indexOfAnyOf:startingAt: and #next:putAll:startingAt:.</span><br><span>String's #format:, #expandMacrosWithArguments:, #unescapePercentsRaw and #jsonWriteOn: (only if you have JSON-ul.56 in your image) all use that pattern.</span><br><span></span><br><span></span><br><span>Levente<span></span><br></span></div></blockquote></body></html>