With the Array operations: append or insert
var tmp: [CChar] = [0, 0]
for i in 1 ... 100 {
tmp.insert(0, at: 0)
}
Regards,
Rien
Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Balancingrock
Project: http://swiftfire.nl - A server for websites build
How do I append character A-Z by integer into CChar and benchmark timing
how fast it’s append compare to UInt8?
var tmp: [CChar] = [0,0]
for var i in 0...256 {
tmp[0] = 100
}
print(String(cString: &tmp))
On Sun, Apr 9, 2017 at 3:17 AM, Proyb P wrote:
> Agree, in some case, I seem to find
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.
On Sunday, 9 April 2017, Rien wrote:
> Server-side is usually UTF-8 (not always), so often you don’t really need
>
Server-side is usually UTF-8 (not always), so often you don’t really need
strings.
As an aside, time measurements are difficult, especially when IO is involved
there may be thread switches or locks.
I have written some parsers (UTF-8 based) and not yet encountered performance
problems. (though
I ran with -Ounchecked as most benchmark do, are there more optimization
level I'm not aware?
On Sun, Apr 9, 2017 at 12:44 AM, Shawn Erickson wrote:
> What optimization level did you try this at? You are also including the
> print func in your performance test which is a non-trivial amount of co
What optimization level did you try this at? You are also including the
print func in your performance test which is a non-trivial amount of code
being executed. Also when in doubt profile the code to see the time spent
to better nail down the hotspot locations.
If performance issues exist then le
I have found this took about 0.001s to print 256 characters
Compare to Python took 0.16s to print 256 characters, see F8 code and
have modify to run only one call instead of 1000 iterations.
https://gist.github.com/anonymous/18e372e8d0173e77b5c405920d4d3080
As this is frequently use for server