소스 정보
- 저장소
- tomevault-io/skills-registry
- 최근 소스 활동
- 2026년 7월 3일 19:45
- 감지된 SKILL.md 언어
- 영어
- 스타
- 0
- 포크
- 0
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/skills-registry --skill swift-auth-performance-benchmarks명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | swift-auth-performance-benchmarks |
| description | >- Use when this capability is needed. |
Auth latency is felt: a slow token refresh stalls every gated request, and a slow cold-start auth
check delays first paint. This skill measures those paths with ContinuousClock — the monotonic,
high-resolution clock that (unlike Date()) is immune to NTP/user clock changes — and computes
percentiles by hand, because Swift Testing ships no percentile helper. Budgets are configurable per
environment; the examples use realistic OAuth/OIDC envelopes.
Announce on invoke: "Using swift-auth-performance-benchmarks to add ContinuousClock p50/p95 latency tests for the auth subsystem."
Do not reach for XCTest here. ContinuousClock keeps these in Swift Testing; the only reason to
fall back to XCTest is when you specifically need an Apple-shipped XCTMetric probe (CPU/memory
counters), which is a different measurement.
| API | Form (verified) | Use |
|---|---|---|
ContinuousClock | let clock = ContinuousClock() | Monotonic stopwatch; iOS 16+. Not affected by system clock changes. |
Clock.measure(_:) | func measure(_ work: () throws -> Void) rethrows -> Duration | Time a synchronous block. |
| async measure | await clock.measure { await … } (measure(isolation:_:)) | Time an async block; or use the now / duration(to:) form below. |
clock.now + duration(to:) | let start = clock.now; …; let d = start.duration(to: clock.now) | Explicit, async-safe interval; unambiguous across overloads. |
Duration | .milliseconds(50), < | Express and compare budgets. |
| percentile | (hand-rolled — sort + index) | Swift Testing has no built-in percentile. |
Collect N samples (100 for p50/p95; 1000 for a stable p99), sort(), then index:
p50 = samples[count/2], p95 = samples[Int(Double(count - 1) * 0.95)]. Don't assume an
XCTMeasureOptions-style statistic exists in Swift Testing — it doesn't.
First-run effects (class load, code-sign cache, lazy URLSession setup) inflate the first few
measurements. Drop the first 3–5 samples before computing percentiles, or the p50 is a lie.
ContinuousClock, not Date()Date() can jump backward on NTP sync, producing negative or absurd intervals. ContinuousClock is
monotonic — the only correct primitive for a benchmark.
p50 < 1 s / p95 < 3 s is a reasonable LTE envelope for OAuth refresh; on Wi-Fi expect p50 < 400 ms / p95 < 1 s. Cold-start Keychain read + JWT decode should be < 50 ms (Keychain reads are ~1–5 ms; decode is sub-ms for tokens < 4 KB). Read the budget from config so CI, dev, and device can differ.
A coalescence test must assert both: the fan-out's wall-clock ≈ 1× single-refresh latency (not N×), and the network mock observed exactly 1 call. Either alone can pass while the bug hides.
Process-RSS probes (task_info / TASK_VM_INFO) are brittle in unit tests. For a static check use
MemoryLayout<T>.size ("the token model is < 256 bytes"); for real memory profiling use Instruments.
import Testing
import Foundation
@testable import MyApp
@Suite("Auth performance")
struct AuthPerformanceTests {
/// Hand-rolled percentile — Swift Testing has none built in.
private func percentile(_ p: Double, of samples: [Duration]) -> Duration {
let sorted = samples.sorted()
return sorted[Int(Double(sorted.count - 1) * p)]
}
@Test func tokenRefreshLatencyMeetsBudget() async throws {
let clock = ContinuousClock()
let session = AuthSession()
var samples: [Duration] = []
for i in 0..<105 {
let start = clock.now
_ = try? await session.refresh()
let elapsed start.duration(to: clock.now)
i { samples.append(elapsed) }
}
#expect(percentile(, of: samples) .milliseconds())
#expect(percentile(, of: samples) .milliseconds())
}
() {
clock ()
elapsed clock.measure {
(service: , account: ).readBlocking()
.decode(.sampleJWT)
}
#expect(elapsed .milliseconds())
}
() {
clock ()
session ()
elapsed clock.measure {
withTaskGroup(of: .) { group
{ group.addTask { session.refresh() } }
}
}
#expect(elapsed .milliseconds())
#expect(session.networkCallCount )
}
() {
#expect(<.>.size )
}
}
ContinuousClock, percentiles over ≥100 samples.MemoryLayout<T>.size, no clock needed.XCTMetric (the one place to leave Swift Testing).global-skills/apple-auth/swift-auth-security-audit-suite/SKILL.md — the correctness counterpart:
it asserts coalescence is single-flight; this skill asserts it's also fast.global-skills/apple-auth/swift-testing-framework-conventions-mvvm/SKILL.md — when to stay in Swift
Testing vs fall back to XCTest's XCTMetric.global-skills/apple-auth/swift-auth-security-checklist/SKILL.md — the single-flight refresh design
whose latency this measures.Last verified: 2026-06-03 against Swift ContinuousClock / Clock.measure / Duration (Apple
Developer docs, live; sync measure and the async measure(isolation:_:) overload both confirmed).
Swift Testing ships no percentile helper — percentiles are hand-rolled here.
Re-check after: WWDC26 + any CryptoKit/Security release, or by 2026-12-01. Decay risk: low
(ContinuousClock is a stable Swift primitive).
Found a drift? Run /skill-pattern-freshness-audit apple-auth.
Source: esaldgut/ai-native-engineering-workspace — distributed by TomeVault.