Performance Testing#
-
We mainly rely on Chrome's
Performancetab to analyse and record the performance of MarkText -
Electron is split into 3 processes:
main,preloadandrenderer. We will be focusing onmainandrenderersince these are the heaviest
1. Testing main process#
pnpm run perf:inspect-brk-
This launches a production build of Marktext that has a break-point before the first line of Javascript is ran
-
A debugger at port
5858is also attached
1.1 Navigate to Chrome Inspect#
-
Go to
chrome://inspect -
Press
Configure, and addlocalhost:5858 -
Press "Inspect" on the entry that appears below (might take a while)
1.2 Record Performance#
-
When Developers Tools first launches, you will notice the breakpoint that is set
-
Simply go to
Performance, pressRecord, and wait for MarkText to launch fully, then Stop the recording
1.3 Alternative: inspect#
- If you do not need the breakpoint to test start-up performance, simply run:
pnpm run perf:inspect2. Testing renderer#
pnpm run start-
This previews the most recent
pnpm run buildoutput viaelectron-vite previewwithPERF_TESTING=true(so it behaves like a production launch). It does not rebuild — re-runpnpm run build:unpackfirst if your sources changed. -
Press
F12to open Dev Tools and pressReload and Recordto benchmark start-up render performance
