feat: Add token processing and generation speed to usage report#328
feat: Add token processing and generation speed to usage report#328dwash96 merged 2 commits intocecli-dev:v0.91.5from
Conversation
- Add --show-speed flag to enable speed display (disabled by default) - Track LLM response time (llm_elapsed) after streaming completes - Track time to first token (TtFT) for streaming responses - Calculate and display prompt processing speed (tokens/sec) - Calculate and display token generation speed (output tokens/sec) Output with --show-speed: LLM elapsed time: X.XX seconds (TtFT: X.XXs) Speed: XXX prompt tokens/sec, XXX output tokens/sec 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
I'm not really into this structure of just sort of adding random if statements in an already long and dense file, instead of say a more general helpers/profiler.py file that, probably a start(self, type), log(self, type), elapsed(self, type) or similar. And the profiler handles gathering, and restoring the state of these types of timers. _add_speed_info() makes sense but I want to drive towards general utilities that handle discrete and useful operations |
|
Hi, thanks for taking time to review my slop. I tried to address your concerns and make it composable instead of adding complexity into already dense logic. Now base_coder.py diff is as minimal as possible, while keeping all functionality. Please advise if I can improve it even better. |
|
No problem, Time to first token is a good metric to have on hand, I think it's good as is, I'll change |
|
Oh, but can you set up and run the pre-commit hook stuff, for the formatting? I want to be a bit more focused on making sure PRs are well formatted just as like a community standard |
|
Thanks, cool! |
Summary
Adds token speed metrics to the usage report when
--show-speedflag is enabled.Features
Output Example
With
--show-speedenabled:Without the flag, no timing information is shown.
Changes
aider/args.py: Added--show-speedargumentaider/coders/base_coder.py:_add_speed_info()helper method--show-speedis enabled🤖 Generated with Claude Code