Profiling Electron Startup logo

Profiling Electron Startup

Community
Innei
profiling-electron-startup

Use when an Electron app feels slow to launch — Dock icon bounces too long, blank or late window, long skeleton before the UI — or when someone hands over a generic "Electron startup optimization" checklist and asks what applies to this app.

Overview

PublisherInnei
RepositorySKILL
Skill nameprofiling-electron-startup
Stars
81
Forks
2
Bundled files
6
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Innei on GitHub. Read the source before you install it.

Installation

Install the Profiling Electron Startup AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Innei/SKILL.git /tmp/SKILL
mkdir -p .claude/skills
cp -r /tmp/SKILL/skills/automation/profiling-electron-startup .claude/skills/profiling-electron-startup
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Profiling Electron Startup in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Profiling Electron Startup on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Profiling Electron Startup is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Profiling Electron Startup

Core principle: segment the timeline before touching code. Most generic advice (bundle main, lazy-load, ASAR, thin preload, defer the updater) is already done in a mature app; the remaining time sits in segments JS cannot reach. Measure first, then only pull levers whose segment is actually big.

The four segments

T0 exec ──A──▶ T1 main.js first line ──B──▶ T2 app `ready` ──C──▶ T3 window shown ──D──▶ T4 UI first frame
SegmentWhat it isWho owns itTypical warm (M-series)
Adyld, signature checks, Chromium+Node initmacOS / Electron90–130ms warm, 1.5–2s first launch of a new binary (post-update)
Bmain bundle load + top-level new App()you50–70ms; V8 compile ≈ 40% of it
CwhenReady native tail + new BrowserWindow + renderer spawn + first paintElectron (mostly)50ms + 70–80ms + 100–150ms
Dmodule graph eval, React bootrenderer bundle300–800ms

Dock bounce ends at ready (applicationDidFinishLaunching). Nothing in D affects it; nothing in JS can end it earlier than B finishing. There is no native call for it — app.dock.cancelBounce() only cancels dock.bounce().

Recipe

  1. Package first. Measure the packaged build (asar, minified), never dev. Run with an isolated --user-data-dir=<tmp> — the single-instance lock otherwise exits silently ("Another instance is already running").
  2. Instrument the entry. Unpack: npx @electron/asar extract app.asar Resources/app then rename app.asar — Electron loads app.asar over an app/ dir. CJS entry: scripts/instrument-entry.mjs patches it in place (keeps .bak). ESM entry (.mjs, "type": "module"): imports hoist, so use scripts/main-probe.mjs as a wrapper and point package.json main at it. Both emit [boot] lines (uptime at entry / bundle loaded / ready / browser-window-created / load-start / ready-to-show) and, with LOBE_PROF=<file>, an inspector CPU profile; LOBE_SCRIPTS=<file> lists every script V8 parsed before the page loads (find what the boot graph drags in).
  3. Launch N times with scripts/launch-timing.sh — external wall-clock T0 plus the [boot] lines. Do one run on a fresh binary to see the A cold cost, then 3 warm.
  4. Split B/C with the CPU profile → scripts/cpuprofile-summary.mjs. Look for: wrapSafe / compileSourceTextModule (compile), ModuleJob link (ESM graph size), native dlopen, View / ImageView (= new BrowserWindow native ctor, 60–80ms, not yours — the icon option is not what makes it slow).
  5. Split C/D with --trace-startup --trace-startup-format=jsonscripts/trace-summary.mjs: commit → firstPaintMarkDOMContent/MarkLoad, resource waterfall, long tasks.
  6. Only now pick levers (below). Re-measure after each.

Levers, with measured payoff

LeverWhereGainNotes
Show window on loading-screen first paintpreload: MutationObserver for #loading-screen → double rAFipcRenderer.send; main: show on that OR ready-to-show, idempotent−230ms to visible windowready-to-show fires at load, not first paint; adding <img>/text to the loading screen does NOT fix it
module.enableCompileCache()rollup/rolldown output.banner on the entry chunkmain bundle 55→37msbanner, not index.ts: bundlers hoist chunk requires above entry statements
Show at creation (show: true + backgroundColor)main−350ms~180ms of blank window; users notice — prefer the first-paint lever
Lazy require native addons at top levelmain2–3ms each warm, more coldonly if profile shows dlopen
Lazy-import boot-graph fat (LOBE_SCRIPTS list, biggest files first)app code908KB sucrase off the path: −30msOnly when every caller is already async; a parser/SDK/catalog imported statically by a service is the usual culprit
Smaller asarbuildfirst-launch A only100MB+ asars make post-update launches worse
Dev: stream Vite transform progress onto the loading screenserve-only plugin: transform hook count → server.hot.send; injected client renders it while any boot placeholder existsdev UX onlyplaceholder ids: #loading-screen, plus React skeleton ids

Tried, no gain (don't repeat)

  • Creating BrowserWindow before an in-process kernel/server boots, gating only loadURL: the window is created earlier but the page still waits for the kernel, and its ESM linking competes with window/renderer spawn for the main thread — total unchanged.
  • Dropping the macOS BrowserWindow.icon option: the 60ms native frame is the ctor itself.
  • enableCompileCache() inside an ESM entry for its static graph: that graph is compiled before any body runs; it only helps dynamic imports after it (still worth it when the big graph is dynamic).

Common mistakes

  • Trusting process.uptime() as exec time: its origin is Node init, after segment A. Pair with an external clock.
  • --cpu-prof is ignored by Electron; use inspector.Session from the entry.
  • --trace-startup default output is protobuf; pass --trace-startup-format=json.
  • screencapture takes ~300ms — useless for catching a 150ms blank frame; prove paint via double rAF or the trace.
  • Vibrancy/transparent/frame options do not change new BrowserWindow cost (tested).
  • Reading app.getPath('userData') before your own setPath pins it.
  • Kill leftover Vite on the dev port before restarting dev (lsof -ti :5173 | xargs kill).

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Profiling Electron Startup AI skill do?

Use when an Electron app feels slow to launch — Dock icon bounces too long, blank or late window, long skeleton before the UI — or when someone hands over a generic "Electron startup optimization" checklist and asks what applies to this app.

Why use Profiling Electron Startup on TypingMind?

Because you install it once and use it with any model. Profiling Electron Startup is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Profiling Electron Startup in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Innei/SKILL/tree/main/skills/automation/profiling-electron-startup. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Profiling Electron Startup?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Profiling Electron Startup?

As many as you like. As long as a model supports skills, you can use Profiling Electron Startup with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Profiling Electron Startup AI skill free?

It is published on GitHub by Innei. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇