mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-04 19:55:00 +00:00
perf: adjust min_delay based on markdown render time for smoother updates
This commit is contained in:
parent
3fc5cf8b9f
commit
891868b061
1 changed files with 6 additions and 1 deletions
|
@ -126,8 +126,13 @@ class MarkdownStream:
|
||||||
return
|
return
|
||||||
self.when = now
|
self.when = now
|
||||||
|
|
||||||
# time how long this takes and set min_delay to it. ai!
|
# Measure render time and adjust min_delay to maintain smooth rendering
|
||||||
|
start = time.time()
|
||||||
lines = self._render_markdown_to_lines(text)
|
lines = self._render_markdown_to_lines(text)
|
||||||
|
render_time = time.time() - start
|
||||||
|
|
||||||
|
# Set min_delay to render time plus a small buffer
|
||||||
|
self.min_delay = max(render_time * 1.1, 1./30) # At least 30fps
|
||||||
|
|
||||||
|
|
||||||
num_lines = len(lines)
|
num_lines = len(lines)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue