Agree, in some case, I seem to find Cchar is really shine at 10x faster than Python from A to Z, 1000x faster than normal Swift? Not sure if there was flaw in the time measurement.<br><br>On Sunday, 9 April 2017, Rien &lt;<a href="mailto:Rien@balancingrock.nl">Rien@balancingrock.nl</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Server-side is usually UTF-8 (not always), so often you don’t really need strings.<br>
As an aside, time measurements are difficult, especially when IO is involved there may be thread switches or locks.<br>
<br>
I have written some parsers (UTF-8 based) and not yet encountered performance problems. (though faster is always better)<br>
<br>
Regards,<br>
Rien<br>
<br>
Site: <a href="http://balancingrock.nl" target="_blank">http://balancingrock.nl</a><br>
Blog: <a href="http://swiftrien.blogspot.com" target="_blank">http://swiftrien.blogspot.com</a><br>
Github: <a href="http://github.com/Balancingrock" target="_blank">http://github.com/<wbr>Balancingrock</a><br>
Project: <a href="http://swiftfire.nl" target="_blank">http://swiftfire.nl</a> - A server for websites build in Swift<br>
<br>
<br>
<br>
<br>
<br>
<br>
&gt; On 08 Apr 2017, at 18:19, Proyb P via swift-users &lt;<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;swift-users@swift.org&#39;)">swift-users@swift.org</a>&gt; wrote:<br>
&gt;<br>
&gt; I have found this took about 0.001s to print 256 characters<br>
&gt; Compare to Python took 0.000016s to print 256 characters, see F8 code and have modify to run only one call instead of 1000 iterations.<br>
&gt; <a href="https://gist.github.com/anonymous/18e372e8d0173e77b5c405920d4d3080" target="_blank">https://gist.github.com/<wbr>anonymous/<wbr>18e372e8d0173e77b5c405920d4d30<wbr>80</a><br>
&gt;<br>
&gt; As this is frequently use for server-side swift that will definitely affected by expensive call, are there any alternative solution for converting Int to character close to Python timing?<br>
&gt;<br>
&gt; import Foundation<br>
&gt; var display: String = &quot;&quot;<br>
&gt;<br>
&gt;     func printTimeElapsedWhenRunningCod<wbr>e(title: String, operation: ()-&gt;()) {<br>
&gt;         let startTime = CFAbsoluteTimeGetCurrent()<br>
&gt;         operation()<br>
&gt;         let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime<br>
&gt;         print(&quot;Time elapsed for \(title): \(timeElapsed) s&quot;)<br>
&gt;     }<br>
&gt;<br>
&gt;     printTimeElapsedWhenRunningCod<wbr>e(title: &quot;s1()&quot;) {<br>
&gt; let startingValue = Int((&quot;A&quot; as UnicodeScalar).value) // 65<br>
&gt; for i in 0 ..&lt; 256 {<br>
&gt;     print(Character(UnicodeScalar(<wbr>i + startingValue)!))<br>
&gt; }<br>
&gt; }<br>
&gt; ______________________________<wbr>_________________<br>
&gt; swift-users mailing list<br>
&gt; <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;swift-users@swift.org&#39;)">swift-users@swift.org</a><br>
&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-users" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-users</a><br>
<br>
</blockquote>