Skip to content

Conversation

@ThomasK33
Copy link
Member

@ThomasK33 ThomasK33 commented Oct 28, 2025

Tokenization now runs in worker threads to prevent blocking during heavy encoding operations, maintaining UI responsiveness.

The previous synchronous approach with fallback approximations caused UI lag when calculating token counts for large chat histories.
Moving tokenization off the main thread keeps the UI responsive even during expensive tokenization workloads.

Key changes:

  • Worker thread pool using node:worker_threads
  • All tokenizer APIs converted to async
  • IPC channels for renderer-side tokenization
  • Frontend LRU cache with Suspense integration
  • Real-time token estimates in ChatInput
  • Updated ~50 test files for async API

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33 ThomasK33 force-pushed the thomask33/10-28-add_tokenizer_pool branch 15 times, most recently from ed3632f to 9055fe1 Compare November 2, 2025 18:44
@ThomasK33 ThomasK33 changed the title feat: enable async token counting with piscina workers perf: async tokenization with worker threads Nov 2, 2025
@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33 ThomasK33 force-pushed the thomask33/10-28-add_tokenizer_pool branch from 9055fe1 to f997ff8 Compare November 2, 2025 19:06
@ThomasK33
Copy link
Member Author

@codex review

1 similar comment
@ThomasK33
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33
Copy link
Member Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Tokenization now runs in worker threads to prevent blocking during
heavy encoding operations, maintaining UI responsiveness.

Previous synchronous approach with fallback approximations caused
UI lag when calculating token counts for large chat histories. Moving
tokenization off the main thread keeps the UI responsive at 60fps
even during expensive tokenization workloads.

Key changes:
- Worker thread pool using node:worker_threads
- All tokenizer APIs converted to async
- IPC channels for renderer-side tokenization
- Frontend LRU cache with Suspense integration
- Real-time token estimates in ChatInput
- Updated ~50 test files for async API
@ThomasK33 ThomasK33 force-pushed the thomask33/10-28-add_tokenizer_pool branch from cd26335 to 5c7d7a0 Compare November 3, 2025 01:33
@ThomasK33 ThomasK33 merged commit d86727b into main Nov 3, 2025
15 checks passed
@ThomasK33 ThomasK33 deleted the thomask33/10-28-add_tokenizer_pool branch November 3, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant