Skip to content

Commit 7f97c3c

Browse files
committed
Merge remote-tracking branch 'origin/new-io-perf-glyph-cache'
2 parents 5d14406 + c31fbd4 commit 7f97c3c

181 files changed

Lines changed: 31966 additions & 5103 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/xcode.yml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
env:
10-
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
10+
DEVELOPER_DIR: /Applications/Xcode_26.0.app/Contents/Developer
1111

1212
jobs:
1313
build:
@@ -37,6 +37,9 @@ jobs:
3737
- name: Swift Package Build
3838
run: swift build -v
3939

40+
- name: Check generated Unicode widths
41+
run: python3 scripts/regen_unicode_width_data.py --check
42+
4043
- name: Run tests
4144
env:
4245
SWIFT_TEST_DISABLE_PARALLELIZATION: "1"
@@ -49,3 +52,71 @@ jobs:
4952
swift test --enable-code-coverage
5053
BINDIR=$(swift build --show-bin-path)
5154
xcrun llvm-cov report "$BINDIR/SwiftTermPackageTests.xctest/Contents/MacOS/SwiftTermPackageTests" --instr-profile=.build/debug/codecov/default.profdata -use-color
55+
56+
thread-sanitizer:
57+
58+
runs-on: macos-15
59+
60+
steps:
61+
- uses: actions/checkout@v4
62+
63+
- name: Stage A Thread Sanitizer Tests
64+
env:
65+
SWIFT_TEST_DISABLE_PARALLELIZATION: "1"
66+
run: swift test --sanitize=thread --filter "TerminalLocking|SynchronizedOutput|TerminalIOPipeline"
67+
68+
swiftpm-strict-concurrency:
69+
70+
runs-on: macos-15
71+
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: Build SwiftTerm with complete concurrency checking
76+
run: >-
77+
swift build --target SwiftTerm
78+
-Xswiftc -strict-concurrency=complete
79+
80+
swift6-tools:
81+
82+
runs-on: macos-15
83+
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Build SwiftTerm benchmarks
88+
run: swift build --package-path Tools/SwiftTermBenchmarks
89+
90+
- name: Build RenderBench
91+
run: swift build --package-path Tools/RenderBench
92+
93+
- name: Build and test BidiHarness
94+
run: >-
95+
xcodebuild
96+
-project Tools/BidiHarness/BidiHarness.xcodeproj
97+
-scheme BidiHarness
98+
-destination 'platform=macOS'
99+
test
100+
CODE_SIGNING_ALLOWED=NO
101+
102+
linux-headless:
103+
104+
runs-on: ubuntu-latest
105+
container: swift:6.2-jammy
106+
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Build SwiftTerm
111+
run: swift build --target SwiftTerm
112+
113+
- name: Build SwiftTerm with complete concurrency checking
114+
run: >-
115+
swift build --target SwiftTerm
116+
-Xswiftc -strict-concurrency=complete
117+
118+
- name: Run headless tests
119+
env:
120+
SWIFT_TEST_DISABLE_PARALLELIZATION: "1"
121+
run: >-
122+
swift test

Benchmarks/SwiftTermBenchmarks/SwiftTermBenchmarks.swift

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Dispatch
2+
import Foundation
3+
4+
@main
5+
struct UnicodeColumnWidthBenchmark {
6+
private static let corpus = """
7+
ASCII and Latin: The quick brown fox; café; naïve. \
8+
Combining: e\u{0301} a\u{20D1}. \
9+
CJK: 日本語 漢字. \
10+
Hangul: 한글 \u{1100}\u{1161}. \
11+
Emoji: 😀👍🏽. \
12+
Regional indicators: 🇺🇸. \
13+
Supplementary narrow: \u{10000}\u{10400}\u{1D400}.
14+
"""
15+
16+
static func main ()
17+
{
18+
// Read through the environment so that the compiler cannot replace the
19+
// fixed corpus and width calls with constants.
20+
let input = ProcessInfo.processInfo.environment ["SWIFTTERM_WIDTH_CORPUS"] ?? corpus
21+
let scalars = Array (input.unicodeScalars)
22+
let iterations = Int (ProcessInfo.processInfo.environment ["SWIFTTERM_WIDTH_ITERATIONS"] ?? "") ?? 200_000
23+
var samples: [Double] = []
24+
var checksum = 0
25+
26+
for _ in 0..<5 {
27+
let start = DispatchTime.now ().uptimeNanoseconds
28+
for _ in 0..<iterations {
29+
for scalar in scalars {
30+
checksum &+= UnicodeUtil.columnWidth (rune: scalar)
31+
}
32+
}
33+
let nanoseconds = DispatchTime.now ().uptimeNanoseconds - start
34+
samples.append (Double (nanoseconds) / 1_000_000)
35+
}
36+
37+
samples.sort ()
38+
print ("scalars=\(scalars.count) calls-per-sample=\(scalars.count * iterations) " +
39+
"median-ms=\(samples [2]) samples-ms=\(samples) checksum=\(checksum)")
40+
}
41+
}

0 commit comments

Comments
 (0)