Skip to content

0.4.1

Latest

Choose a tag to compare

@mackoj mackoj released this 14 Nov 03:11
· 3 commits to main since this release
Immutable release. Only release title and notes can be modified.
849fe82

Faster, and three fixes. No API changes.

Fixes

  • Literal.source and Literal.write no longer crash on a value holding a range. swift-format requires folded operators and called fatalError on 0...3. Operators are folded first.
  • A string containing "\r\n" renders. It is one Character, so per-Character escaping missed it and the render threw. Strings are escaped per Unicode scalar now.
  • SwiftLiteralReflection no longer links Testing and XCTest. DependenciesTestSupport was a dependency of the engine target. An executable using it outside a test runner failed to launch with Library not loaded: @rpath/Testing.framework.
  • A .swift-format source scoped with withDependencies applies whole. CodeFormatter read the global LiteralConfig instead of the source the render was given.

Performance

p50, 0.4.0 → 0.4.1, same machine:

Benchmark Wall clock Mallocs
Literal.source, one order 2.10 ms → 1.19 ms 5,515 → 3,391
Literal.source, 1000 orders 1.59 s → 0.76 s 2.99M → 1.34M
Render 1000 orders 141 ms → 84 ms 476K → 248K
Render 2000 strings with escapes 9.0 ms → 5.5 ms 18K → 15K
Render an enum tree 40 deep 944 µs → 405 µs 4,621 → 1,885

Output is byte-identical. What paid off, and how to measure: docs/performance.md.