Skip to content

Commit

Permalink
perf(check.service.js): optimize memory usage and performance in prot…
Browse files Browse the repository at this point in the history
…otype pollution script

Refactored the ppfang script to enhance memory efficiency and performance. Implemented lazy
evaluation for property difference calculations and optimized iframe usage by introducing a reusable
clean window context. This update minimizes the memory footprint and improves the execution speed,
especially in scenarios where the script is run multiple times.
  • Loading branch information
acuciureanu committed Jan 16, 2024
1 parent cdfc8b4 commit 77eca91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion services/check.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const probeAll = async (urls, concurrency = 10) => {
try {
const { results } = await PromisePool.for(urls)
.withConcurrency(concurrency)
.onTaskFinished((url, pool) => console.log(`[${pool.processedPercentage().toFixed(2)}%] Processed ${url} ...`))
.onTaskFinished((url, pool) =>
console.log(`[${pool.processedPercentage().toFixed(2)}%] Processed ${url} ...`)
)
.process(async (url) => {
const page = pages.length > 0 ? pages.shift() : await browser.newPage();
const result = await probe(url, page);
Expand Down

0 comments on commit 77eca91

Please sign in to comment.