Skip to content

Instantly share code, notes, and snippets.

@iamakulov
Last active May 11, 2020 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamakulov/7fb2e981748087712b6b5a26a06f67a8 to your computer and use it in GitHub Desktop.
Save iamakulov/7fb2e981748087712b6b5a26a06f67a8 to your computer and use it in GitHub Desktop.
Notion: API caching test methodology

I did a series of local tests to determine how quickly Notion would load if all API responses were available near-immediately. Full article → Case study: Analyzing Notion app performance

Methodology

Preparation

  1. Use Charles as a local HTTP/2 proxy
  2. Intercept and save API responses for the following requests:
    • POST /api/v3/loadPageChunk
    • POST /api/v3/getUserAnalyticsSettings
    • POST /api/v3/getClientExperiments
    • POST /api/v3/getPublicPageData
    • POST /api/v3/syncRecordValues
  3. Using the “Map local” feature, make above requests serve saved responses from the local FS
  4. Confirm that with “Map local” enabled, response times go down from 200+ ms to 20+ ms
  5. Go to Chrome DevTools → Audits → Settings and uncheck the “Simulated throttling” flag

Running tests

  1. With “Map local” disabled (but with Charles still running), run 3 performance audits
  2. With “Map local” enabled, run 3 other performance audits

Extracting results

  1. For each performance audit:
    • click “View trace”
    • go to Frames
    • find the first frame which has the page text
    • and record the timestamp of that frame

Results

Raw performance traces.

Without “Map local”, ms With “Map local”, ms
Audit 1 20887 18570
Audit 2 21472 19355
Audit 3 20685 18817
Average 21015 18914

Improvement: 9.9%

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