<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">A -1 from me to deprecating the mode. I’ve been using Swift in high-performance situations such as in a game engine, where in particular thing like integer overflow checks become a measurable cost in tight inner loops. Currently I can’t use Array in many places due to ownership issues and retain/release costs, but once that hopefully becomes feasible I’d also definitely want the option to elide e.g. range checks. <div><br><div>I’m aware there are alternatives to e.g. add without overflow checking with &+ (which I use in some cases to make debug mode usable), but in general it’s very useful to be able to test with these checks in debug mode and then have them stripped in a release build once you’re reasonably confident they’re safe. </div><div><br></div><div>As a side note, if you’re only discussing renaming, I <i>think</i> it’s already exposed as two separate options in Xcode: you have optimisation level (mapping to -Onone, -O, -O,-wmo) and a separate ‘Disable Safety Checks’ option. Mapping the compiler flags to match would I think make sense.</div><div><br></div><div>I’m curious as to when you see performance regressions with -Ounchecked. Does it limit the ability of the compiler to make some optimisations?<br><div><br><div id="AppleMailSignature">Thomas</div><div><br>On 3/11/2017, at 9:35 AM, Johannes Weiß via swift-dev <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><span></span><br><span></span><br><blockquote type="cite"><span>On 2 Nov 2017, at 1:33 pm, Erik Eckstein <<a href="mailto:eeckstein@apple.com">eeckstein@apple.com</a>> wrote:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On Nov 2, 2017, at 10:51 AM, Johannes Weiß <<a href="mailto:johannesweiss@apple.com">johannesweiss@apple.com</a>> wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Definitely a +1 from me, a haven't recently seen much of a difference either.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>Said that I do sometimes use it in a micro-benchmark just to convince myself we don't lose much performance on the checks. Usually it turns out fine, I'm happy and move on. But I guess there's some value in being able to elide a lot of checks just to see how much of a difference it does. And if there's a big difference then I'd try to optimise the program and elide unnecessary checks myself. Clearly -Ounchecked should never be used in any real code but I find having a baseline when optimising performance very helpful and -Ounchecked sometimes seemed like a cheap, automatic baseline for some code ;).</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>And lastly I always thought having it as an 'optimisation' is a misnomer, it's not an optimisation as it clearly changes the semantics of the program quite a bit. I thought '-unsafe-remove-checks' or something describes it better, a bit like '-assume-single-threaded’.</span><br></blockquote></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I like that idea. We could add such an option.</span><br></blockquote><span></span><br><span>awesome, that's be a +💯 from me then 🙂</span><br><span></span><br><span></span><br><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Daniel, I think that’s also what you were asking for.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>But probably the 'no checks' mode adds too much complexity to just keep it around for a questionable way to do performance baselines.</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>On 2 Nov 2017, at 9:52 am, Erik Eckstein via swift-dev <<a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a>> wrote:</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Hi,</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>I’d like to propose to deprecate the -Ounchecked swift optimization mode.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>The -Ounchecked mode actually contradicts one of the main goals of swift: to be a safe language.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>In the past we didn’t see lot of significant performance differences compared to -O (there were some improvements but also some regressions).</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Also, we want to reduce the effort of maintaining too many different optimization modes, especially because we recently added -Osize.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Deprecating would mean that we map -Ounchecked to -O.</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>If you have any comments or concerns, please let me know</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Thanks,</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Erik</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>_______________________________________________</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>swift-dev mailing list</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span><a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span><a href="https://lists.swift.org/mailman/listinfo/swift-dev">https://lists.swift.org/mailman/listinfo/swift-dev</a></span><br></blockquote></blockquote></blockquote><span></span><br><span>_______________________________________________</span><br><span>swift-dev mailing list</span><br><span><a href="mailto:swift-dev@swift.org">swift-dev@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-dev">https://lists.swift.org/mailman/listinfo/swift-dev</a></span><br></div></blockquote></div></div></div></body></html>