4 ms·
My guess it is all of the string converting back and forth to character arrays.
by rookie 10y ago
My guess it is all of the string converting back and forth to character arrays.
- rookie 10y agoYep, replaced string with Int array and now it is much faster. https://gist.github.com/rookie/3d9a848c6fefacc4254da921da79b467 https://gist.github.com/rookie/3d9a848c6fefacc4254da921da79b... It now runs faster (when compiled, optimized) than the python code. xcrun -sdk macosx swiftc -O gen.swift
- nicky0 10y agoOoh yeah, 0m0.363s for 1000 iterations on mine. So the slowness was in the string manipulation and character conversion operations.
- SOLAR_FIELDS 10y agoI've learned from years of working on making code more performant that the biggest code smells to look at first are string operations.