<html><body><p>Sorry, I shouldn't have assumed that everyone know what the Computer Language Benchmark Game was.<br><br>There's a set of 10 toy benchmarks written in 30 different languages that are available here: <a href="http://benchmarksgame.alioth.debian.org/">http://benchmarksgame.alioth.debian.org/</a> The webpage also lets you see the results of regular performance runs and see how the various programs stack up against each other.<br><br>As usual with small benchmarks, there are lots of ways in which the programs aren't realistic. <br><br>After dispatch became available on Linux with Swift 3, I had a side project of going through the Swift implementations and adding concurrency to a few Swift programs that didn't have it already.<br><br>regex-dna is the main outlier for Swift (which is why I had profiled it). There's enough ARC overhead that using dispatch actually made it slower...<br> The sequential version for of regex-dna for Swift is: <a href="http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&lang=swift&id=2">http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&lang=swift&id=2</a><br> My slower concurrent version is: <a href="http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&lang=swift&id=3">http://benchmarksgame.alioth.debian.org/u64q/program.php?test=regexdna&lang=swift&id=3</a><br><br>I suspect that the main fix for improving the performance of this program is actually doing something in CoreFoundation, but I got sidetracked and didn't finish looking into it.<br><br>--dave<br><br><img width="16" height="16" src="cid:1__=0ABB0A59DFEFF22D8f9e8a93df938690918c0AB@" border="0" alt="Inactive hide details for Michael Gottesman ---02/17/2017 05:32:03 PM---> On Feb 17, 2017, at 11:30 AM, David P Grove via swift"><font color="#424282">Michael Gottesman ---02/17/2017 05:32:03 PM---> On Feb 17, 2017, at 11:30 AM, David P Grove via swift-dev <swift-dev@swift.org> wrote: ></font><br><br><font size="2" color="#5F5F5F">From: </font><font size="2">Michael Gottesman <mgottesman@apple.com></font><br><font size="2" color="#5F5F5F">To: </font><font size="2">David P Grove/Watson/IBM@IBMUS</font><br><font size="2" color="#5F5F5F">Cc: </font><font size="2">Jiho Choi <jray319@gmail.com>, swift-dev <swift-dev@swift.org></font><br><font size="2" color="#5F5F5F">Date: </font><font size="2">02/17/2017 05:32 PM</font><br><font size="2" color="#5F5F5F">Subject: </font><font size="2">Re: [swift-dev] Profiling ARC</font><br><font size="2" color="#5F5F5F">Sent by: </font><font size="2">mgottesman@apple.com</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br>
<ul><ul><font size="4">On Feb 17, 2017, at 11:30 AM, David P Grove via swift-dev <</font><a href="mailto:swift-dev@swift.org"><u><font size="4" color="#0000FF">swift-dev@swift.org</font></u></a><font size="4">> wrote:</font><br>
<p><a href="mailto:swift-dev-bounces@swift.org"><tt><u><font size="4" color="#0000FF">swift-dev-bounces@swift.org</font></u></tt></a><tt><font size="4"> wrote on 02/16/2017 09:48:28 PM:<br>> <br>> I was curious about the overhead of ARC and started profiling some <br>> benchmarks found in the Computer Language Benchmark Game (http://<br>> </font></tt><a href="http://benchmarksgame.alioth.debian.org/u64q/measurements.php?lang=swift"><tt><u><font size="4" color="#0000FF">benchmarksgame.alioth.debian.org/u64q/measurements.php?lang=swift</font></u></tt></a><tt><font size="4">). <br>> So far, it seems that ARC sequence optimization is surprisingly good<br>> and most benchmarks don't have to perform ARC operations as often as<br>> I expected. I have some questions regarding this finding.<br>> <br>> I compiled all benchmarks with "-O -wmo" flags and counted the <br>> number of calls to ARC runtime (e.g., swift_rt_swift_retain) using Pin.<br>> <br>> 1. Reference counting is considered to have high overhead due to <br>> frequent counting operations which also have to be atomic. At least<br>> for the benchmarks I tested, it is not the case and there is almost <br>> no overhead. Is it expected behavior? Or is it because the <br>> benchmarks are too simple (they are all single-file programs)? How <br>> do you estimate the overhead of ARC would be?<br>> </font></tt><font size="4"><br></font><tt><font size="4"><br>hmm, I wonder if your method of profiling is really finding all the ARC operations. The Swift version of regex-dna is about 25x slower than the Java version (on Linux). 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. </font></tt></ul></ul><font size="4">Question. Where is this regex-dna benchmark, is it in the swift benchmark suite?</font><ul><ul><tt><font size="4"><br>--dave</font></tt><font size="4"><br></font><i><font size="4"><br>(See attached file: regex-dna.svg)</font></i><p><font size="4"><regex-dna.svg>_______________________________________________<br>swift-dev mailing list</font><u><font size="4" color="#0000FF"><br></font></u><a href="mailto:swift-dev@swift.org"><u><font size="4" color="#0000FF">swift-dev@swift.org</font></u></a><font size="4"><br></font><font size="4"><a href="https://lists.swift.org/mailman/listinfo/swift-dev">https://lists.swift.org/mailman/listinfo/swift-dev</a></font></ul></ul><br><br><BR>
</body></html>