Skip to content

Conversation

@darkskygit
Copy link

fix #760

调整截图调用链以优化截图速度

[2024-03-23][23:29:17][INFO][pot::window] mouse_position: 6µs
[2024-03-23][23:29:17][INFO][pot::window] Mouse position: 875, 640
[2024-03-23][23:29:17][INFO][pot::window] Current Monitor: Monitor { name: Some("\\\\.\\DISPLAY1"), size: PhysicalSize { width: 2560, height: 1600 }, position: PhysicalPosition { x: 0, y: 0 }, scale_factor: 1.5 }
[2024-03-23][23:29:17][INFO][pot::window] current_monitor: 150.9µs
[2024-03-23][23:29:17][INFO][pot::window] position: 155.7µs
[2024-03-23][23:29:17][INFO][pot::screenshot] Screenshot screen with position: x=0, y=0, 0ns
[2024-03-23][23:29:17][INFO][pot::screenshot] Screen: DisplayInfo { id: 2776250164, x: 0, y: 0, width: 2560, height: 1600, rotation: 0.0, scale_factor: 1.0, is_primary: true }, 130.6µs
[2024-03-23][23:29:17][INFO][pot::screenshot] APP: 139.8µs
[2024-03-23][23:29:17][INFO][pot::screenshot] cache_dir: 154.5µs
[2024-03-23][23:29:17][INFO][pot::screenshot] bundle.identifier: 159.8µs
[2024-03-23][23:29:17][INFO][pot::screenshot] capture screen: 90.4274ms
[2024-03-23][23:29:17][INFO][pot::screenshot] to_png: 98.6395ms
[2024-03-23][23:29:17][INFO][pot::window] screenshot: 101.6898ms
[2024-03-23][23:29:17][INFO][pot::window] Mouse position: 875, 640
[2024-03-23][23:29:17][INFO][pot::window] Current Monitor: Monitor { name: Some("\\\\.\\DISPLAY1"), size: PhysicalSize { width: 2560, height: 1600 }, position: PhysicalPosition { x: 0, y: 0 }, scale_factor: 1.5 }
[2024-03-23][23:29:17][INFO][pot::window] Window not existence, Creating new window: screenshot
[2024-03-23][23:29:18][INFO][pot::window] screenshot1: 266.825ms
[2024-03-23][23:29:18][INFO][pot::window] loaded1: 379.0019ms
[2024-03-23][23:29:18][TRACE][os_info::imp] windows::current_platform is called
[2024-03-23][23:29:18][TRACE][os_info::imp] Returning Info { os_type: Windows, version: Semantic(10, 0, 22631), edition: Some("Windows 11 Professional"), codename: None, bitness: X64, architecture: None }
[2024-03-23][23:29:18][INFO][pot::window] loaded2: 1.0575282s

优化后,截图+窗口加载时间可以控制在300ms以内,截图正式展示到界面上需要1秒左右
测量版本为rust release+production js版本

日志中,loaded1为截图页js iife执行时emit的事件产生的记录,loaded2为useEffect执行时emit的事件产生的记录

可见js初始化时间占据了不少时间,此pr暂不对这一部分进行优化

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OPTIMIZE]: 优化截图触发链路

1 participant