mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 17:20:35 +08:00
19 lines
621 B
TypeScript
19 lines
621 B
TypeScript
import { readFileByLine, readFileByLineLegacy } from './fetch-text-by-line';
|
|
import path from 'node:path';
|
|
import fsp from 'node:fs/promises';
|
|
import { SOURCE_DIR } from '../constants/dir';
|
|
|
|
const file = path.join(SOURCE_DIR, 'domainset/cdn.conf');
|
|
|
|
(async () => {
|
|
const { bench, group, run } = await import('mitata');
|
|
|
|
group(() => {
|
|
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();
|
|
})();
|