Today I've been toying around with `UUID`s. I wanted to see if I can write a fast Swift UUID parser (without Foundation). To achieve this I used the SIMD Swift instructions. Interestingly the performance was about 6times slower than using `uuid_parse` (from Darwin) and more than ten times slower compared to a simple parsing loop. (The code is attached)
Looking into the performance with Instruments, I've found that there are a lot of calls to `specialized IndexingIterator.next()`. Maybe I'm missing something here, but I wonder why there is an `Iterator` in use?
Attachment: Download
Environment
Xcode: Version 12.0 beta 3 (12A8169g) MacBook Pro (16-inch, 2019) - 2,4 GHz 8-Core Intel Core i9Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Standard Library | |Labels | Bug, simd | |Assignee | None | |Priority | Medium | Watchers: @shahmishal md5: a9b0f1c4918239714c91107417976ce1Issue Description:
Today I've been toying around with `UUID`s. I wanted to see if I can write a fast Swift UUID parser (without Foundation). To achieve this I used the SIMD Swift instructions. Interestingly the performance was about 6times slower than using `uuid_parse` (from Darwin) and more than ten times slower compared to a simple parsing loop. (The code is attached)
Parsing UUIDs: 1000000
-----------------------------
uuid_parse | took: 0.39703s
Loop UUIDKit | took: 0.22107s
SIMD UUIDKit | took: 2.65504s
Foundation | took: 0.54979s
Looking into the performance with Instruments, I've found that there are a lot of calls to `specialized IndexingIterator.next()`. Maybe I'm missing something here, but I wonder why there is an `Iterator` in use?
I assume that this might be related to: https://bugs.swift.org/browse/SR-12777
If you have any questions please reach out. My technical skills (assembler and stuff) are limited though.