@@ -39,6 +39,7 @@ export const DEFAULT_ATTR_DATA = Object.freeze(new AttributeData());
3939
4040// Work variables to avoid garbage collection
4141let $startIndex = 0 ;
42+ const $workCell = new CellData ( ) ;
4243
4344/** Factor when to cleanup underlying array buffer after shrinking. */
4445const CLEANUP_THRESHOLD = 2 ;
@@ -262,9 +263,8 @@ export class BufferLine implements IBufferLine {
262263 }
263264
264265 if ( n < this . length - pos ) {
265- const cell = new CellData ( ) ;
266266 for ( let i = this . length - pos - n - 1 ; i >= 0 ; -- i ) {
267- this . setCell ( pos + n + i , this . loadCell ( pos + i , cell ) ) ;
267+ this . setCell ( pos + n + i , this . loadCell ( pos + i , $workCell ) ) ;
268268 }
269269 for ( let i = 0 ; i < n ; ++ i ) {
270270 this . setCell ( pos + i , fillCellData ) ;
@@ -284,9 +284,8 @@ export class BufferLine implements IBufferLine {
284284 public deleteCells ( pos : number , n : number , fillCellData : ICellData ) : void {
285285 pos %= this . length ;
286286 if ( n < this . length - pos ) {
287- const cell = new CellData ( ) ;
288287 for ( let i = 0 ; i < this . length - pos - n ; ++ i ) {
289- this . setCell ( pos + i , this . loadCell ( pos + n + i , cell ) ) ;
288+ this . setCell ( pos + i , this . loadCell ( pos + n + i , $workCell ) ) ;
290289 }
291290 for ( let i = this . length - n ; i < this . length ; ++ i ) {
292291 this . setCell ( i , fillCellData ) ;
0 commit comments