stencilproject / Stencil

Stencil is a simple and powerful template language for Swift.
https://stencil.fuller.li
BSD 2-Clause "Simplified" License
2.34k stars 224 forks source link

Swift 4.1 #228

Closed yonaskolb closed 6 years ago

yonaskolb commented 6 years ago

This updates the codebase to Swift 4.1 and drops Swift 3 support

Warnings were not cleaned up in Lexer.swift as https://github.com/stencilproject/Stencil/pull/226 will take care of that

yonaskolb commented 6 years ago

Comments addressed and changelog entry added

djbe commented 6 years ago

Would you mind adding the Swift 4 Lexer.swift changes to this PR?

It seems we're going to need to do some more testing, to compare #225 and #226, maybe even add some sort of test to keep track of the performance (so it doesn't tank again), and it's easier if that PR doesn't also have changes related to the Swift migration.

yonaskolb commented 6 years ago

I'd rather leave Lexer.swift alone. To fix the warnings means redoing the substring accessing anyway. I'd rather not cause conflicts in the other performance PRs.

djbe commented 6 years ago

Causing conflicts shouldn't be an issue TBH, the PRs will need a rebase anyway. I just thought that a minimal changeset for the old and new performance PRs might help us test why there's a difference.

yonaskolb commented 6 years ago

I just timed this with my tests. It looks like the last commit took it from 0.48 to 1.07...

djbe commented 6 years ago

Could it be the String( initializers? We may want to try to keep using SubStrings, as it avoids re-allocation/copy operations.

yonaskolb commented 6 years ago

I tried to keep things as substrings, but things like hasPrefix weren't available on linux

djbe commented 6 years ago

And if we define our own functions specifically for Linux?

Note: We should move this discussion to #226.