npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

astro-parallel-build-check

v0.1.5

Published

Run astro build and check in parallel

Downloads

13

Readme

astro-parallel-build-check

Run astro check and astro build in parallel.

Motivation

By default astro runs check and build steps separately, one after the other. This isn't a problem if the checks fail, since we probably don't want to proceed with the build anyway. However if the checks are successful this can be much slower than running them in parallel with the build, especially on machines with multiple CPU cores and projects that spend a lot of time on I/O during builds.

Getting Started

Installation

pnpm add astro-parallel-build-check
yarn add astro-parallel-build-check
npm install astro-parallel-build-check

Usage

Add the astro-parallel-build-check command to the scripts field of your package.json:

{
  "scripts": {
    "build": "astro-parallel-build-check"
  }
}

Benchmark

I used hyperfine to run a quick benchmark of this package versus astro check && astro build

I used an app in testing directory of this repo to run the benchmark. It's the astro blog template that I used to make sure the package works correctly. While this isn't a good example of a real-world app it still demonstrates the performance benefits pretty well.

To get consistent results accross benchmark runs, I used --prepare argument to remove the dist folder and flush disk caches. If you are not on MacOS sync && sudo purge will not do the job, so you'll need to look up how to flush the caches on your system.

Since dropping caches likely requires superuser privileges, you can use sudo -v to temporarily gain the permissions before running the benchmark commands.

$ hyperfine --prepare "rm -rf dist && sync && sudo purge" 'pnpm run build'
Benchmark 1: pnpm run build
  Time (mean ± σ):      4.548 s ±  0.061 s    [User: 7.990 s, System: 0.689 s]
  Range (min … max):    4.459 s …  4.619 s    10 runs
$ hyperfine --prepare "rm -rf dist && sync && sudo purge" 'pnpm run build-parallel'
Benchmark 1: pnpm run build-parallel
  Time (mean ± σ):      3.195 s ±  0.063 s    [User: 8.337 s, System: 0.668 s]
  Range (min … max):    3.149 s …  3.342 s    10 runs

We can see that using astro-parallel-build-check results in almost 1.5s faster build.

Limitations

Passing flags to build and check commands is not supported at the moment. I'm holding off on this because I don't need it and there is a chance I'll never do. The best option would probably be to have the same flags as astro build command and pass the astro check configuration as environment variables.

Contact