Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve performance in AI request logging #14769

Merged

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Jan 24, 2025

What it does

Instead of appending AI requests line by line to the output channel, we now append them in a single step. Since appending to a channel is a relatively expensive operation, this change significantly improves performance for large requests.

This is particularly noticeable when AI inline code completions are enabled for large files, as many requests with many lines may be sent during typing.

Performance Analysis when typing in average speed for 5 seconds in a large file (1000 lines) without this PR

image
image

  • We do not spend any time being idle
  • 92% of time is spent in doAppend of the output channel
Performance Analysis when typing in average speed for 5 seconds in a large file (1000 lines) with this PR

image
image
image

  • A lot is going on but we also were idle 40% of the time
  • Only 3% of the time is spent in doAppend
  • Most time is spent in React and animations
Performance Analysis when typing in average speed for 5 seconds in a large file (1000 lines) without inline completions

image
image

  • Barely any difference compared to enabled completions with this PR

How to test

Enable automatic inline completions and feel the performance difference. Especially noticeable in large files

Breaking changes

  • This PR introduces breaking changes and requires careful review. If yes, the breaking changes section in the changelog has been updated.

Attribution

Review checklist

Reminder for reviewers

Instead of appending AI requests line by line to the output channel, we
now append them in a single step. Since appending to a channel is a
relatively expensive operation, this change significantly improves
performance for large requests.

This is particularly noticeable when AI inline code completions are
enabled for large files, as many requests may be sent during typing.

Also requests text responses by the LLM instead of streamed responses
in the autocomplete case.
@sdirix sdirix force-pushed the improve-autocomplete-performance branch from ca18580 to bd60770 Compare January 24, 2025 15:28
Copy link
Contributor

@eneufeld eneufeld left a comment

Choose a reason for hiding this comment

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

Looks great!

@sdirix sdirix merged commit 7533c95 into eclipse-theia:master Jan 27, 2025
11 checks passed
@sdirix sdirix deleted the improve-autocomplete-performance branch January 27, 2025 08:18
@github-actions github-actions bot added this to the 1.58.0 milestone Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants