Perf: make build faster

This commit is contained in:
SukkaW
2023-08-11 17:24:56 +08:00
parent e58ad2c0ac
commit 82f10868c1
9 changed files with 97 additions and 108 deletions

View File

@@ -29,9 +29,7 @@ async function processDomainLists(domainListsUrl) {
/** @type Set<string> */
const domainSets = new Set();
const rl = await fetchRemoteTextAndCreateReadlineInterface(domainListsUrl);
for await (const line of rl) {
for await (const line of await fetchRemoteTextAndCreateReadlineInterface(domainListsUrl)) {
if (line.startsWith('!')) {
continue;
}
@@ -65,9 +63,8 @@ async function processHosts(hostsUrl, includeAllSubDomain = false) {
/** @type Set<string> */
const domainSets = new Set();
const rl = await fetchRemoteTextAndCreateReadlineInterface(hostsUrl);
for await (const _line of rl) {
const line = processLine(_line);
for await (const l of await fetchRemoteTextAndCreateReadlineInterface(hostsUrl)) {
const line = processLine(l);
if (!line) {
continue;
}

View File

@@ -10,12 +10,10 @@ const { readFileByLine } = require('./fetch-remote-text-by-line');
async function compareAndWriteFile(linesA, filePath) {
await fse.ensureFile(filePath);
const rl = readFileByLine(filePath);
let isEqual = true;
let index = 0;
for await (const lineB of rl) {
for await (const lineB of readFileByLine(filePath)) {
const lineA = linesA[index];
index++;