perf(editor): integrate native preview and prioritize timeline interaction
Gitea CI / Check code and tests (pull_request) Failing after 7m0s
Gitea CI / Gitea CI passed (pull_request) Failing after 5s
Gitea CI / Build Android APK (pull_request) Skipped
Gitea CI / Build Windows x64 app (pull_request) Skipped
Gitea CI / Audit and package Windows x64 (pull_request) Skipped
Gitea CI / Assemble and validate CI artifacts (pull_request) Skipped

This commit is contained in:
lingjhf committed 2026-10-07 16:03:52 +08:00
1 parent 0ecf920669
commit 4f746be301
34 files changed
+3278 -145

No files matched your search

@@ -0,0 +1,89 @@
/// Explicit inputs for the opt-in full-editor benchmark.
class ViewportBenchConfig {
ViewportBenchConfig.fromEnvironment(Map<String, String> environment)
: outputPath = environment['CUTDEX_FULL_APP_VIEWPORT_BENCH']!,
startGate = environment['CUTDEX_FULL_APP_VIEWPORT_START_GATE'],
expectedFrames = _number(environment, 'EXPECTED_FRAMES'),
rounds = _integer(environment, 'ROUNDS', 5),
paired = _flag(environment, 'PAIRED', false),
silent = _flag(environment, 'SILENT', false),
nativeOnly = _flag(environment, 'NATIVE_ONLY', true),
captureHelper = environment['CUTDEX_FULL_APP_VIEWPORT_CAPTURE_HELPER'],
timelineFps = _integer(environment, 'TIMELINE_FPS', 30),
inputHz = _integer(environment, 'INPUT_HZ', 60),
inputCount = _integer(environment, 'INPUT_COUNT', 360),
localStartFrame = _optionalInteger(environment, 'LOCAL_START_FRAME'),
localSpanFrames = _integer(environment, 'LOCAL_SPAN_FRAMES', 20),
localPixelsPerFrame = _number(environment, 'LOCAL_PIXELS_PER_FRAME') ?? 4,
edgeMarginFrames = _integer(environment, 'EDGE_MARGIN_FRAMES', 900),
sampleIntervalMs = _integer(environment, 'SAMPLE_INTERVAL_MS', 16) {
if (outputPath.isEmpty ||
rounds < 1 ||
timelineFps < 1 ||
inputHz < 1 ||
inputCount < 6 ||
inputCount.isOdd ||
localSpanFrames < 1 ||
localPixelsPerFrame <= 0 ||
edgeMarginFrames < 1 ||
sampleIntervalMs < 1 ||
(expectedFrames != null && expectedFrames! <= 0)) {
throw ArgumentError('Invalid viewport benchmark configuration');
}
if (!nativeOnly && (captureHelper == null || captureHelper!.isEmpty)) {
throw ArgumentError('CAPTURE_HELPER is required when NATIVE_ONLY=0');
}
}
final String outputPath;
final String? startGate;
final double? expectedFrames;
final int rounds, timelineFps, inputHz, inputCount, localSpanFrames;
final int edgeMarginFrames, sampleIntervalMs;
final int? localStartFrame;
final double localPixelsPerFrame;
final bool paired, silent, nativeOnly;
final String? captureHelper;
Map<String, Object?> toJson() => {
'expectedFrames': expectedFrames,
'rounds': rounds,
'paired': paired,
'timelineFps': timelineFps,
'inputHz': inputHz,
'inputCount': inputCount,
'localStartFrame': localStartFrame,
'localSpanFrames': localSpanFrames,
'localPixelsPerFrame': localPixelsPerFrame,
'edgeMarginFrames': edgeMarginFrames,
'sampleIntervalMs': sampleIntervalMs,
'nativeOnly': nativeOnly,
'captureHelper': captureHelper,
'silent': silent,
};
static int _integer(Map<String, String> env, String key, int fallback) =>
_optionalInteger(env, key) ?? fallback;
static int? _optionalInteger(Map<String, String> env, String key) {
final value = env['CUTDEX_FULL_APP_VIEWPORT_$key'];
return value == null ? null : int.parse(value);
}
static double? _number(Map<String, String> env, String key) {
final value = env['CUTDEX_FULL_APP_VIEWPORT_$key'];
if (value == null) return null;
final number = double.parse(value);
if (!number.isFinite) throw ArgumentError('Non-finite $key');
return number;
}
static bool _flag(Map<String, String> env, String key, bool fallback) {
final value = env['CUTDEX_FULL_APP_VIEWPORT_$key'];
return switch (value) {
null => fallback,
'1' => true,
'0' => false,
_ => throw ArgumentError('$key must be 0 or 1'),
};
}
}