4 ms·
String operations are also really slow in swift. Python is the same speed or faster
by mahyarm 9y ago
String operations are also really slow in swift. Python is the same speed or faster
- dep_b 9y agoI only remember a very early review of string operation speeds that was pretty bad at times indeed. But that was about Swift 1 and the string implementation has been changed a few times. Do you have any recent source?
- mahyarm 9y agoPersonal experience making the same command line util in python and swift 3 that was parsing code with the same C library (sourcekit) and then doing a bunch of string manipulation after that. Optimized swift 3 & python were the same speed, with %80 of the time being spent in the C library. I would expect swift would at least be 2x faster in that %20 portion that wasn't sourcekit library.
- dep_b 9y agoI think strings in Swift are primarily meant to be very correct above being fast or easy to use. It's more strict than both Python 2 and 3. Handling of languages that use really complex character compositions springs to mind.
- mahyarm 9y agoThere is no obvious way to turn that off fortunately, when you don't need it.
- LeoNatan25 9y agoI think it's coming. Part of the String Manifesto Apple has is that they want to give both worlds.
- Rodd45 9y agoI haven't tried Swift yet but that is my buddy's first impression when he tried it.