# Hook execution reports 8+ seconds delay despite actual execution taking only 5ms

**URL:** <https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584>\
**Category:** Bug Reports\
**Created:** [December 29, 2025, 10:33am UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584 "2025-12-29T10:33:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iheb\_HASNI](https://avatars.discourse-cdn.com/v4/letter/i/9fc348/32.png) [@Iheb\_HASNI](https://forum.cursor.com/u/Iheb_HASNI)\
**Post date:** [December 29, 2025, 10:33am UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/1 "2025-12-29T10:33:08Z")

</div>

### Where does the bug appear (feature/product)?

Cursor IDE

### Describe the Bug

The beforeSubmitPrompt hook infrastructure reports extremely long execution times (7-9 seconds), even though the actual hook script completes in under 10ms.

```json
Command: node ./hooks/log-prompt-test.js (7485ms) exit code: 0

```

Cursor reports hook execution as 7500+ ms while internal timing logs show:

```json
[prompt] Script started at: 1767001406216
[prompt] Received chunk at: 4 ms
[prompt] stdin ended at: 5 ms
[prompt] hi
[prompt] Processing done at: 5 ms

```

### Steps to Reproduce

Create a minimal hook script that only prints and exits:

```js
#!/usr/bin/env node
const startTime = Date.now();
console.error('[prompt] Script started at:', startTime);

let inputData = '';

process.stdin.setEncoding('utf8');

process.stdin.on('data', (chunk) => {
  console.error('[prompt] Received chunk at:', Date.now() - startTime, 'ms');
  inputData += chunk;
});

process.stdin.on('end', () => {
  console.error('[prompt] stdin ended at:', Date.now() - startTime, 'ms');
  
  try {
    const input = JSON.parse(inputData);
    const prompt = input.prompt || '';
    
    console.error('[prompt]', prompt);
    console.error('[prompt] Processing done at:', Date.now() - startTime, 'ms');
    
    console.log(JSON.stringify({ continue: true }));
  } catch (error) {
    console.log(JSON.stringify({ continue: true }));
  }
});

```

Register it in hooks.json

```json
{
  "version": 1,
  "hooks": {
    "beforeSubmitPrompt": [
      {
        "command": "node ./hooks/log-prompt.js"
      }
    ]
  }
}

```

Submit a prompt and observe the reported hook execution time, in the example of logs, we sent a simple **“Hi”**.

### Expected Behavior

Hook execution time should reflect actual script runtime (5-10ms). Hook execution overhead should be in the range of a few hundred milliseconds, not 7-9 seconds.

### Operating System

Windows 10/11

### Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.2.43 (user setup)  
VSCode Version: 1.105.1  
Commit: 32cfbe848b35d9eb320980195985450f244b3030  
Date: 2025-12-19T06:06:44.644Z  
Electron: 37.7.0  
Chromium: 138.0.7204.251  
Node.js: 22.20.0  
V8: 13.8.258.32-electron.0  
OS: Windows\_NT x64 10.0.26200

### For AI issues: which model did you use?

Claude Opus 4.5, Claude Sonnet 4.5

### Additional Information

Device: Dell Latitude 5540  
Processor: 13th Gen Intel Core i7-1370P  
RAM: 32 GB DDR5 4800 MT/s

### Does this stop you from using Cursor

No - Cursor works, but with this issue

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [December 29, 2025, 12:49pm UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/2 "2025-12-29T12:49:19Z")

</div>

Hey, thanks for the report.

This is a known issue caused by Windows process startup overhead for hooks. Even minimal hooks can be noticeably slower on Windows than on macOS. The team is already working on improving hook performance on Windows.

See also: [Similar report for the beforeTabFileRead hook](https://forum.cursor.com/t/beforetabfileread-hook-is-extremely-slow-on-windows-and-events-get-queued-up-works-fine-on-macos/147211)

Since `beforeSubmitPrompt` runs less often than tab-related hooks, the impact should be lower, but the overhead is still noticeable. We’ll track this alongside the existing Windows hook performance improvements.

---

<div class="post-metadata">

**Author:** ![Iheb\_HASNI](https://avatars.discourse-cdn.com/v4/letter/i/9fc348/32.png) [@Iheb\_HASNI](https://forum.cursor.com/u/Iheb_HASNI)\
**Post date:** [January 8, 2026, 3:54pm UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/3 "2026-01-08T15:54:34Z")

</div>

Hello @deanrie , is there any news regarding this issue?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [January 8, 2026, 4:34pm UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/4 "2026-01-08T16:34:58Z")

</div>

Hey @Iheb_HASNI!

We’re shipping some speed improvements to hooks where we we no longer launch a full instance of the user’s Zsh shell. I have a feeling this is where the latency is coming from in reporting the delay.

It’s on nightly now if you’d like to give it a try!

---

<div class="post-metadata">

**Author:** ![Iheb\_HASNI](https://avatars.discourse-cdn.com/v4/letter/i/9fc348/32.png) [@Iheb\_HASNI](https://forum.cursor.com/u/Iheb_HASNI)\
**Post date:** [January 13, 2026, 9:04am UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/5 "2026-01-13T09:04:06Z")

</div>

Hello @Colin

Using the nightly build of Cursor, we’ve observed a significant improvement in hook execution time. The hooks now take approximately 0.8 seconds, with a maximum of around 1.2 seconds, which we consider a strong performance gain.

We’re very happy with these results. Do you have any indication of when this update is expected to be officially released?

Thanks,

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [January 13, 2026, 9:12am UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/6 "2026-01-13T09:12:07Z")

</div>

2.4 is around the corner, sorry I can’t be more specific than that. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [February 4, 2026, 9:13am UTC](https://forum.cursor.com/t/hook-execution-reports-8-seconds-delay-despite-actual-execution-taking-only-5ms/147584/7 "2026-02-04T09:13:09Z")

</div>

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.
