mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: process line stream
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { processLine, processLineFromReadline } from './process-line';
|
||||
import { readFileByLine, readFileByLineLegacy } from './fetch-text-by-line';
|
||||
import path from 'node:path';
|
||||
import fsp from 'node:fs/promises';
|
||||
@@ -10,9 +9,9 @@ const file = path.join(SOURCE_DIR, 'domainset/cdn.conf');
|
||||
const { bench, group, run } = await import('mitata');
|
||||
|
||||
group(() => {
|
||||
bench('readFileByLine', () => processLineFromReadline(readFileByLine(file)));
|
||||
bench('readFileByLineLegacy', () => processLineFromReadline(readFileByLineLegacy(file)));
|
||||
bench('fsp.readFile', () => fsp.readFile(file, 'utf-8').then((content) => content.split('\n').filter(processLine)));
|
||||
bench('readFileByLine', () => Array.fromAsync(readFileByLine(file)));
|
||||
bench('readFileByLineLegacy', () => Array.fromAsync(readFileByLineLegacy(file)));
|
||||
bench('fsp.readFile', () => fsp.readFile(file, 'utf-8').then((content) => content.split('\n')));
|
||||
});
|
||||
|
||||
run();
|
||||
|
||||
Reference in New Issue
Block a user