mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-09 22:31:08 +00:00
perf: use string instead of array for terminal output
Use a string instead of array for terminal output since it is faster than splitting and joining. Also note that 'line' events may contain multiple lines, so concatenating directly is more efficient. Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
This commit is contained in:
parent
5c9f7722b6
commit
e3b682f119
1 changed files with 4 additions and 7 deletions
|
|
@ -964,9 +964,9 @@ export class Cline {
|
|||
}
|
||||
}
|
||||
|
||||
let lines: string[] = []
|
||||
let result = ""
|
||||
process.on("line", (line) => {
|
||||
lines.push(line)
|
||||
result += line
|
||||
if (!didContinue) {
|
||||
sendCommandOutput(line)
|
||||
} else {
|
||||
|
|
@ -978,9 +978,7 @@ export class Cline {
|
|||
let exitDetails: ExitCodeDetails | undefined
|
||||
process.once("completed", (output?: string) => {
|
||||
// Use provided output if available, otherwise keep existing result.
|
||||
if (output) {
|
||||
lines = output.split("\n")
|
||||
}
|
||||
result = output || result
|
||||
completed = true
|
||||
})
|
||||
|
||||
|
|
@ -1004,8 +1002,7 @@ export class Cline {
|
|||
await delay(50)
|
||||
|
||||
const { terminalOutputLineLimit } = (await this.providerRef.deref()?.getState()) ?? {}
|
||||
const output = truncateOutput(lines.join("\n"), terminalOutputLineLimit)
|
||||
const result = output.trim()
|
||||
result = truncateOutput(result, terminalOutputLineLimit)
|
||||
|
||||
if (userFeedback) {
|
||||
await this.say("user_feedback", userFeedback.text, userFeedback.images)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue