Skip to content

Commit

Permalink
optimize dataset parsing in usage script
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Nov 19, 2023
1 parent 235e5dc commit c45db2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/usage/usage.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const archive = await jszip.loadAsync(await response.arrayBuffer());
const file = await archive.file('top-1m.csv.deprecated').async('string');
const BANNER_LINES = 8;
const sites = file
.split('\n')
.slice(BANNER_LINES, limit + BANNER_LINES)
.split('\n', limit + BANNER_LINES)
.slice(BANNER_LINES)
.map(line => line.match(/^\d+,(?<site>.+)$/).groups.site)
.reverse();
echo(green(`downloading and parsing the rank took ${ cyan((Date.now() - start) / 1e3) } seconds\n${ gray('-'.repeat(120)) }`));
Expand Down

0 comments on commit c45db2b

Please sign in to comment.