<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 20, 2017, at 6:31 PM, Jiho Choi &lt;<a href="mailto:jray319@gmail.com" class="">jray319@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I used the older versions (binary-trees #6 &amp; binary-trees #7) which I downloaded a couple of weeks ago.&nbsp; It seems like they updated binary-trees benchmarks since then.<div class=""><br class=""></div><div class="">I just profiled the one you linked and got a similar result.&nbsp; The optimizer removed about 30% of ARC operations, which is better than almost none in the older versions.&nbsp; However, compared to other benchmarks, where most of ARC operations in the user code are removed, it is still pretty low.</div></div></div></blockquote><div><br class=""></div><div>Sure. I wasn't saying anything about the number of ARC operations in that benchmark. I just wanted to be clear which benchmark was being talked about that is all.</div><br class=""><blockquote type="cite" class=""><div class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Mon, Feb 20, 2017 at 5:20 PM Michael Gottesman &lt;<a href="mailto:mgottesman@apple.com" class="">mgottesman@apple.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg">Are you talking about this one (there are two)?<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><a href="http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&amp;lang=swift&amp;id=1" class="gmail_msg" target="_blank">http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&amp;lang=swift&amp;id=1</a></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Michael</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Feb 20, 2017, at 2:24 PM, Jiho Choi via swift-dev &lt;<a href="mailto:swift-dev@swift.org" class="gmail_msg" target="_blank">swift-dev@swift.org</a>&gt; wrote:</div><br class="gmail_msg m_6741773049348946667Apple-interchange-newline"></blockquote></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg">You are right that regex has many ARC operations from libFoundation.&nbsp; Another outlier in terms of the number of ARC operations is binary-tree.&nbsp; In this case, ARC operations are from the user code, and the optimizer couldn't make much difference.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Other than these two, the optimizer seems working pretty well in removing ARC operations.<br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Fri, Feb 17, 2017 at 1:34 PM David P Grove &lt;<a href="mailto:groved@us.ibm.com" class="gmail_msg" target="_blank">groved@us.ibm.com</a>&gt; wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_msg"><p class="gmail_msg"><tt class="gmail_msg"><a href="mailto:swift-dev-bounces@swift.org" class="gmail_msg" target="_blank">swift-dev-bounces@swift.org</a> wrote on 02/16/2017 09:48:28 PM:</tt><br class="gmail_msg"><tt class="gmail_msg">&gt; <br class="gmail_msg">&gt; I was curious about the overhead of ARC and started profiling some <br class="gmail_msg">&gt; benchmarks found in the Computer Language Benchmark Game (http://<br class="gmail_msg">&gt; <a href="http://benchmarksgame.alioth.debian.org/u64q/measurements.php?lang=swift" class="gmail_msg" target="_blank">benchmarksgame.alioth.debian.org/u64q/measurements.php?lang=swift</a>).&nbsp;<br class="gmail_msg">&gt; So far, it seems that ARC sequence optimization is surprisingly good<br class="gmail_msg">&gt; and most benchmarks don't have to perform ARC operations as often as<br class="gmail_msg">&gt; I expected.&nbsp; I have some questions regarding this finding.</tt><br class="gmail_msg"><tt class="gmail_msg">&gt; <br class="gmail_msg">&gt; I compiled all benchmarks with "-O -wmo" flags&nbsp;and counted the <br class="gmail_msg">&gt; number of calls to ARC runtime (e.g., swift_rt_swift_retain) using Pin.</tt><br class="gmail_msg"><tt class="gmail_msg">&gt; <br class="gmail_msg">&gt; 1. Reference counting is considered to have high overhead due to <br class="gmail_msg">&gt; frequent counting operations which also have to be atomic.&nbsp; At least<br class="gmail_msg">&gt; for the benchmarks I tested, it is not the case and there is almost <br class="gmail_msg">&gt; no overhead.&nbsp; Is it expected behavior?&nbsp; Or is it because the <br class="gmail_msg">&gt; benchmarks are too simple (they are all single-file programs)?&nbsp; How <br class="gmail_msg">&gt; do you estimate the overhead of ARC would be?</tt><br class="gmail_msg"><tt class="gmail_msg">&gt; <br class="gmail_msg"></tt><br class="gmail_msg"></p></div><div class="gmail_msg"><p class="gmail_msg"><tt class="gmail_msg">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="gmail_msg"><br class="gmail_msg"><tt class="gmail_msg">--dave</tt><br class="gmail_msg"><br class="gmail_msg"><i class="gmail_msg">(See attached file: regex-dna.svg)</i><br class="gmail_msg">
</p></div>
</blockquote></div></div></div></div></blockquote></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">
_______________________________________________</div></blockquote></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg">swift-dev mailing list<br class="gmail_msg"><a href="mailto:swift-dev@swift.org" class="gmail_msg" target="_blank">swift-dev@swift.org</a><br class="gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class="gmail_msg"></div></blockquote></div></div></div></blockquote></div>
</div></blockquote></div><br class=""></body></html>