zachleat / bench-framework-markdown

A set of scripts to test markdown processing speeds in various site generators/frameworks
34 stars 13 forks source link

Test Astro with MDX #4

Closed jonathantneal closed 2 years ago

jonathantneal commented 2 years ago

This adds a test for Astro with the official MDX extension.

Why? Because Astro recently deprecated the use of components/expressions/variables in Markdown files, which makes me wonder if it makes the comparison a little less than 1:1.

See the deprecation notice.

I’m not suggesting these tests will run faster, but I hope their notice and official MDX extension would be considered a realistic scenario for working with Markdown. At least, I think it would be helpful to know the impact this would have on any Astro user using components, expressions, or variables.

As I may not be able to replicate your testing conditions, I’m offering this as a PR, but please know I won’t be offended if you decline it.

jonathantneal commented 2 years ago

For what it’s worth, I see very little difference between astro and astro-with-mdx when running the metrics, myself.

This result set was generated on a MacBook Air (M1, 2020), macOS Monterey 12.4, 16 GB memory.

From 3 runs of ./bench-astro.sh 4000:

real    0m31.859s
user    0m38.656s
sys     0m3.330s

real    0m31.691s
user    0m39.041s
sys     0m3.304s

real    0m31.687s
user    0m38.694s
sys     0m3.235s

From 3 runs of ./bench-astro-with-mdx.sh 4000:

real    0m32.416s
user    0m38.556s
sys     0m3.195s

real    0m31.740s
user    0m38.797s
sys     0m3.247s

real    0m31.834s
user    0m38.801s
sys     0m3.309s

One other note. For both the astro test and astro-with-mdx test, I needed to change this:

cp ../../_markdown-samples/$count/* ./src/pages/posts/

to this:

mkdir -p ./src/pages/posts/
cp ../../_markdown-samples/$count/* ./src/pages/posts/

When you were inventing this, you may have created this directory, but had not noticed it is not present by default from the repo.

zachleat commented 2 years ago

I’ll run these tests locally and plan to update the blog post soon with the additional data, thanks!

zachleat commented 2 years ago

I did append one more small bullet point about this PR to https://www.zachleat.com/web/build-benchmark/#summary though the results did seem to be very similar!

(Thank you!)