<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 17, 2017, at 2:31 PM, Michael Gottesman via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Feb 17, 2017, at 11:30 AM, David P Grove via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><p class=""><tt class=""><a href="mailto:swift-dev-bounces@swift.org" class="">swift-dev-bounces@swift.org</a><span class="Apple-converted-space">&nbsp;</span>wrote on 02/16/2017 09:48:28 PM:</tt><br class=""><tt class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; I was curious about the overhead of ARC and started profiling some<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; benchmarks found in the Computer Language Benchmark Game (http://<br class="">&gt;<span class="Apple-converted-space">&nbsp;</span><a href="http://benchmarksgame.alioth.debian.org/u64q/measurements.php?lang=swift" class="">benchmarksgame.alioth.debian.org/u64q/measurements.php?lang=swift</a>).&nbsp;<br class="">&gt; So far, it seems that ARC sequence optimization is surprisingly good<br class="">&gt; and most benchmarks don't have to perform ARC operations as often as<br class="">&gt; I expected.&nbsp; I have some questions regarding this finding.</tt><br class=""><tt class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; I compiled all benchmarks with "-O -wmo" flags&nbsp;and counted the<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; number of calls to ARC runtime (e.g., swift_rt_swift_retain) using Pin.</tt><br class=""><tt class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; 1. Reference counting is considered to have high overhead due to<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; frequent counting operations which also have to be atomic.&nbsp; At least<br class="">&gt; for the benchmarks I tested, it is not the case and there is almost<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; no overhead.&nbsp; Is it expected behavior?&nbsp; Or is it because the<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; benchmarks are too simple (they are all single-file programs)?&nbsp; How<span class="Apple-converted-space">&nbsp;</span><br class="">&gt; do you estimate the overhead of ARC would be?</tt><br class=""><tt class="">&gt;<span class="Apple-converted-space">&nbsp;</span><br class=""></tt><br class=""><tt class="">hmm, &nbsp;I wonder if your method of profiling is really finding all the ARC operations. &nbsp;The Swift version of regex-dna is about 25x slower than the Java version (on Linux). &nbsp;I looked at some prof profiles about a month ago and at the time roughly 80% of all execution samples were attributed to swift_retain/swift_release operations coming from CoreFoundation's regex implementation. &nbsp;</tt><br class=""></p></div></div></blockquote><div class="">Question. Where is this regex-dna benchmark, is it in the swift benchmark suite?</div></div></div></blockquote><div><br class=""></div><div>Here is a Swift version:</div><div><a href="http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&amp;lang=swift&amp;id=2" class="">http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&amp;lang=swift&amp;id=2</a></div><div><br class=""></div><div><br class=""></div>And here is a Java version:</div><div><a href="http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&amp;lang=java&amp;id=7" class="">http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&amp;lang=java&amp;id=7</a></div><div><br class=""></div><div>And, BTW, Swift version is not multi-threaded, but Java version is.<br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><div class=""><p class=""><br class=""><tt class="">--dave</tt><br class=""><br class=""><i class="">(See attached file: regex-dna.svg)</i><br class=""></p></div><span id="cid:1__=0ABB0A59DFF9EF118f9e8a93df938690918c0AB@" class="">&lt;regex-dna.svg&gt;</span>_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-dev mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-dev@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">swift-dev@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a></div></blockquote></div><br class=""></body></html>