<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="">I am also agains introducing mark-and-sweep GC to Swift. I don’t see any real advantages to having it in the language and while explicitly building ownership graphs might seem tedious, I think it is a very useful modelling step that allows one to build better code. <div class=""><br class=""></div><div class="">But since we are already talking about this, here are two small thoughts:</div><div class=""><br class=""></div><div class=""> 1. I would love to see support for region-based allocation in Swift. To those unfamiliar with the concept: a region is basically a sub-heap from which objects are allocated. The allocation is very fast, because it usually just increments the pointer (a region could be implemented as a linked list of memory pages). All objects in the region are deallocated at once. This can be very useful in a case where you have a lot of small allocations that are guaranteed not to escape a certain scope. Essentially, you can remove the overhead of refcounting (but ARC should take care of that already), but also remove the overhead of deallocating every small object individually. It should be possible to do this in a safe way, e.g. by ensuring that only one reference to a object exists of any time (my type theory is very very rusty, but wasn’t that accomplished by linear types)?</div><div class=""><br class=""></div><div class="">2. For those interested in mark-and-seep GC, check out the draft of the GC that Mike Pall (author of the incredible LuaJIT tracing compiler) designed: <a href="http://wiki.luajit.org/New-Garbage-Collector" class="">http://wiki.luajit.org/New-Garbage-Collector</a> . I don’t think that GC ever got implemented, but it uses some quite clever tricks to ensure that its incredibly fast. It is also designed around smart use of bit-ops and cache-friendly data structures (e.g. the sweep phases are implemented via streaming ANDs, ORS and XORS which fully utilise SIMD units). Some very cool stuff. Note: I only link it here because it is interesting, not because I think its a good match for a language like Swift. </div><div class=""><br class=""></div><div class="">Best, </div><div class=""><br class=""></div><div class=""> Taras</div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 09 Feb 2016, at 21:24, Ilya Belenkiy 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="">In addition to memory and performance, the approach "just write it somehow, and the system will optimize it for you so you don't have to" leads to bad code that is slow and uses too many resources.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Feb 9, 2016 at 1:30 PM David Turnbull via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">On Tue, Feb 9, 2016 at 9:04 AM, Paul Cantrell via swift-evolution <span dir="ltr" class=""><<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>></span> wrote:<br class=""></div><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">That island has other inhabitants: video game developers.</div></div></blockquote><div class=""><br class=""></div></div></div></div><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">Audio systems too. 60fps video has a hard limit of 16.66ms per frame. Real time audio needs 3ms buffers, imo, but can be less strict depending on the application.</div><div class=""><br class=""></div><div class="">I think that Swift can become the first serious alternative to C++ for game development and creative coding. For all platforms, not just Avalon (the Isle of Apples, wokka wokka). If Swift becomes a mark-sweep GC language I'm going to get very angry and abandon my work from the last two months: <a href="https://github.com/AE9RB/SwiftGL" target="_blank" class="">https://github.com/AE9RB/SwiftGL</a></div></div></div></div><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">-david</div></div></div></div>
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>