String internals
Why can't you index a String with an integer like text[3], and why is text.count O(n)?
Why can't you index a String with an integer like text[3], and why is text.count O(n)?
A Swift String is made of Unicode grapheme clusters, so one character has a variable byte length, which rules out integer indexing and O(1) count.
SwiftShort answerExpert
You need a struct ImageBuffer that wraps a large pixel buffer, keeps value semantics, and…
#performance
SwiftShort answerAdvanced
Say your resume claims "ContiguousArray is faster than Array." In a pre-interview the…
#performance
SwiftShort answerAdvanced
You need to put a very large Dictionary, hundreds of thousands of entries, into a struct…
#performance
CS fundamentals and algorithmsMultiple choiceAdvanced
You iterate over 100,000 coordinates and sum distances. Between these two versions…
#performance