basic read ahead optimization

This commit is contained in:
Jörg Breitbart
2026-04-24 16:49:06 +02:00
parent 849a9a53ca
commit 8e12e69e4e
2 changed files with 16 additions and 56 deletions
+7 -47
View File
@@ -1240,38 +1240,18 @@ describe('EscapeSequenceParser', () => {
it('single APC', () => { it('single APC', () => {
test('\x1b_X3+$aäbc;däe\x9c', [ test('\x1b_X3+$aäbc;däe\x9c', [
['apc start'], ['apc start'],
//['apc put', '3+$aäbc;däe'], ['apc put', '3+$aäbc;däe'],
['apc put', '3'],
['apc put', '+'],
['apc put', '$'],
['apc put', 'a'],
['apc put', 'ä'],
['apc put', 'b'],
['apc put', 'c'],
['apc put', ';'],
['apc put', 'd'],
['apc put', 'ä'],
['apc put', 'e'],
['apc end', true] ['apc end', true]
], null); ], null);
}); });
it('multi APC', () => { it('multi APC', () => {
test('\x1b_Xabc;de', [ test('\x1b_Xabc;de', [
['apc start'], ['apc start'],
//['dcs put', 'abc;de'] ['apc put', 'abc;de']
['apc put', 'a'],
['apc put', 'b'],
['apc put', 'c'],
['apc put', ';'],
['apc put', 'd'],
['apc put', 'e'],
], null); ], null);
testTerminal.clear(); testTerminal.clear();
test('abc\x9c', [ test('abc\x9c', [
//['apc put', 'abc'], ['apc put', 'abc'],
['apc put', 'a'],
['apc put', 'b'],
['apc put', 'c'],
['apc end', true] ['apc end', true]
], true); ], true);
}); });
@@ -1279,12 +1259,7 @@ describe('EscapeSequenceParser', () => {
test('abc\x9fAbc;de\x9cxyz', [ test('abc\x9fAbc;de\x9cxyz', [
['print', 'abc'], ['print', 'abc'],
['apc start'], ['apc start'],
//['apc put', 'bc;de'], ['apc put', 'bc;de'],
['apc put', 'b'],
['apc put', 'c'],
['apc put', ';'],
['apc put', 'd'],
['apc put', 'e'],
['apc end', true], ['apc end', true],
['print', 'xyz'] ['print', 'xyz']
], null); ], null);
@@ -1293,12 +1268,7 @@ describe('EscapeSequenceParser', () => {
test('abc\x1b_Abc;de\x1b\\xyz', [ test('abc\x1b_Abc;de\x1b\\xyz', [
['print', 'abc'], ['print', 'abc'],
['apc start'], ['apc start'],
//['apc put', 'bc;de'], ['apc put', 'bc;de'],
['apc put', 'b'],
['apc put', 'c'],
['apc put', ';'],
['apc put', 'd'],
['apc put', 'e'],
['apc end', true], ['apc end', true],
['print', 'xyz'] ['print', 'xyz']
], null); ], null);
@@ -1353,12 +1323,7 @@ describe('EscapeSequenceParser', () => {
test('abc\x9fXbc;de\x18', [ test('abc\x9fXbc;de\x18', [
['print', 'abc'], ['print', 'abc'],
['apc start'], ['apc start'],
//['apc put', 'bc;de'], ['apc put', 'bc;de'],
['apc put', 'b'],
['apc put', 'c'],
['apc put', ';'],
['apc put', 'd'],
['apc put', 'e'],
['apc end', false] // false for abort ['apc end', false] // false for abort
], null); ], null);
}); });
@@ -1366,12 +1331,7 @@ describe('EscapeSequenceParser', () => {
test('abc\x9fXbc;de\x1a', [ test('abc\x9fXbc;de\x1a', [
['print', 'abc'], ['print', 'abc'],
['apc start'], ['apc start'],
//['apc put', 'bc;de'], ['apc put', 'bc;de'],
['apc put', 'b'],
['apc put', 'c'],
['apc put', ';'],
['apc put', 'd'],
['apc put', 'e'],
['apc end', false] // false for abort ['apc end', false] // false for abort
], null); ], null);
}); });
+9 -9
View File
@@ -886,16 +886,16 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
this._apcParser.start(this._collect << 8 | code); this._apcParser.start(this._collect << 8 | code);
break; break;
case ParserAction.APC_PUT: case ParserAction.APC_PUT:
// FIXME: this is wrong, must be 00/08 .. 00/13, 02/00 .. 07/14 + NON_ASCII_PRINTABLE
// inner loop - exit APC_PUT: 0x18, 0x1a, 0x1b, 0x9c // inner loop - exit APC_PUT: 0x18, 0x1a, 0x1b, 0x9c
// for (let j = i + 1; ; ++j) { // allowed: 00/08 .. 00/13, 02/00 .. 07/14 + NON_ASCII_PRINTABLE
// if (j >= length || (code = data[j]) === 0x18 || code === 0x1a || code === 0x1b || code === 0x9c || (code > 0x7f && code < NON_ASCII_PRINTABLE)) { // FIXME: 00/08 .. 00/13 currently handled by second APC_PUT invocation
// this._apcParser.put(data, i, j); for (let j = i + 1; ; ++j) {
// i = j - 1; if (j >= length || data[j] < 0x20 || (data[j] >= 0x7f && data[j] < NON_ASCII_PRINTABLE)) {
// break; this._apcParser.put(data, i, j);
// } i = j - 1;
// } break;
this._apcParser.put(data, i, i+1); }
}
break; break;
case ParserAction.APC_END: case ParserAction.APC_END:
handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a); handlerResult = this._apcParser.end(code !== 0x18 && code !== 0x1a);