<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 23, 2017, at 4:04 PM, Ted F.A. van Gaalen via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><font size="4" class=""><br class=""></font><div class=""><blockquote type="cite" class=""><div class="">On 23 Feb 2017, at 02:24, Dave Abrahams <<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Equally a non-starter. All known threadsafe schemes that require caches to be updated upon non-mutating operations have horrible performance issues, and further this would penalize all string code by reserving space for the cache and filling it even for the vast majority of operations that don't require random access. </div></div></div></blockquote><div class="">Well, maybe “caching” is not the right description for what I've suggested.</div><div class="">It is more like:</div><div class=""> let all strings be stored as they are now, but as soon as you want to work with </div><div class="">random accessing parts of a string just “lift the string out of normal optimised string storage” </div><div class=""> and then add (temporarily) a Character array so one can work with this array directly ” </div><div class="">which implies that all other strings remain as they are. ergo: efficiency </div><div class="">is only reduced for the “elevated” strings,</div><div class="">Using e.g. str.freeSpace(), if necessary, would then place the String back </div><div class="">in its normal storage domain, thereby disposing the Character array</div><div class="">associated with it. </div></div></div></div></blockquote><br class=""></div><div>Wouldn’t that turn simple character access into a mutating function?</div><div><br class=""></div><div>- Dave Sweeris</div></body></html>