Skip to content

fix(tui): ~1800x times image pasting performance improvement #38880

Open
affanali2k3 wants to merge 2 commits into
anomalyco:devfrom
affanali2k3:improved-image-pasting-speed
Open

fix(tui): ~1800x times image pasting performance improvement #38880
affanali2k3 wants to merge 2 commits into
anomalyco:devfrom
affanali2k3:improved-image-pasting-speed

Conversation

@affanali2k3

@affanali2k3 affanali2k3 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #38879

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The old code for pasting image was really slow due to creating an external shell like osascript and powershell which adds unnecessary overhead. First I tried creating a binary for each platform and then using exec to execute it directly for reading image from clipboard but it wasnt a good solution as we had to ship binaries for each platform in codebase. Then I went around a bit and found out a really good package by mario which uses rust for this specific purpose. The package works really well and uses napi to execute rust code. I tried on all platforms and there are no errors. I also added proper test cases because the old ones werent really good. Now the speed is around 0.07ms its like a 1800x boost from the old one.

How did you verify your code works?

I ran it on all 3 platforms and copied and pasted images and also see if agent was able read them.

Screenshots / recordings

I enabled keystroke visualization look at bottom left corner and see how its literally instant the time I press and it displaying the image marker. Compare to the issue one it feels so good now.

Screen.Recording.2026-07-25.at.11.09.43.PM.mov

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Improved image pasting speed doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@affanali2k3 affanali2k3 changed the title Improved image pasting speed fix(tui): ~1800x times image pasting performance improvement Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pasting image is too slow

1 participant