Skip to content

perf(integrations): import only the Google APIs in use - #1639

Merged
viethung0o0 merged 1 commit into
mainfrom
perf/google-api-narrow-imports
Nov 3, 2026
Merged

viethung0o0 merged 1 commit into
mainfrom
perf/google-api-narrow-imports

Conversation

@viethung0o0

Copy link
Copy Markdown
Contributor

Summary

  • The Google Sheets and Google Calendar integrations now import only the API they use, instead of the whole googleapis package.
  • The full package loads every Google API, which costs about 60 MB of heap and 600 ms at load time. Loading only Sheets and Calendar costs about 4 MB and 45 ms.
  • It also removes about 80% of the type definitions that tsc has to read for the builder (4.05M to 0.82M lines). A cold builder type check goes from 54s to 43s, and peak memory drops only slightly (6.9 GB to 6.55 GB).
  • The imports use an explicit .../index.js path, because a directory import fails in plain Node ESM.
  • The barrel-only GaxiosError type is replaced by a minimal local type. The code only reads errors from it, so runtime behavior is unchanged.

Verification

  • Integration unit tests pass for both packages; type checks pass.
  • Both entry points load in plain Node ESM.
  • Not verified: calls against the real Google APIs.

Related to #1620

- Import Sheets and Calendar directly instead of the googleapis barrel
- Replace the barrel-only GaxiosError type with a minimal local type
@github-actions github-actions Bot added the improvement Refactor or performance improvement label Nov 3, 2026
@viethung0o0
viethung0o0 marked this pull request as ready for review November 3, 2026 10:04
@viethung0o0
viethung0o0 merged commit 1bf70b4 into main Nov 3, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Refactor or performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants