Skip to content

Commit

Permalink
add frontmatter benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheoni committed Nov 19, 2024
1 parent f3c9f8a commit b638d06
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
57 changes: 57 additions & 0 deletions benches/frontmatter_test_recipe.cook
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
servings: 4
emoji: 🥟
tags: warm, fried, starter
source: CooklangCLI Seed <https://github.com/cooklang/CookCLI/blob/main/seed/Potstickers.cook>
prep time: 20 min
cook time: 30 min
---

[- Same recipe, same metadata. Just in a YAML frontmatter now -]


Let's first make some dough. Set kettle with some water and prepare
@strong white flour{75%g} and @plain flour{75%g}.

Put the flours into a bowl. Mix the @just-boiled water{75%ml} with the
@salt{2%tsp}, then add this to the flour, mixing it in with a knife. It will
seem very floury to start with but keep going and it will come together. Don’t
be tempted to add more water. Cover with a damp cloth for 10 minutes, then
remove and knead until the dough is smooth and elastic. Cover the dough again
and leave it to stand somewhere warm for an hour.

Cut the dough into 2 equal pieces and dust your work surface with flour. Roll
the dough out as thinly as you can. It will be resistant to start with, but you
will eventually end up with a round about 35cm in diameter and with a thickness
of less than 1mm.

Cut the dough into rounds using a 9cm cutter, then repeat with the other piece
of dough. Knead the offcuts together and roll again. You should end up with at
least 24 discs. Dust with flour in between each one if you want to stack them
together.

Heat the @olive oil{1%tbsp} in a frying pan and gently cook very finely shredded
and chopped @Chinese cabbage{100%g}, very finely grated @carrot{50%g} and finely
chopped @spring onions{3%items} until they have wilted down. Remove from the
heat and stir in very finely chopped @strained kimchi{75%g}. Taste for seasoning
and add salt and pepper if you think it necessary. Allow to cool.

Assemble the dumplings by putting a teaspoon of filling in the centre of each
wrapper. Wet around the sides – thoroughly, as they can sometimes crack – then
pinch the edges together, pleating from the middle down each side to seal.

Make the dipping sauce by mixing @soy sauce{2%tbsp}, @rice wine vinegar{1%tbsp},
@chilli oil{1%tbsp} and @sesame oil{1%tsp} together. Taste for seasoning and add
salt if necessary.

To cook, heat @olive oil{3%tbsp} in a non-stick frying pan that has a lid – you
need just enough oil to thinly cover the base. Add some of the dumplings, making
sure they are well spread out.

Fry the dumplings over a medium heat until they are crisp and brown underneath,
then add water – just enough to thinly cover the base of the pan. Cover the pan
quickly, as it will spit when you add the water, and steam the dumplings for 5
minutes, until they are starting to look translucent and the water has
evaporated. Uncover and cook for a further minute to make sure the underside is
still crisp. Remove and keep warm while you cook the rest. Serve hot with the
dipping sauce.
6 changes: 6 additions & 0 deletions benches/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use criterion::{criterion_group, criterion_main, Criterion};
use cooklang::{parser::PullParser, CooklangParser, Extensions};

const TEST_RECIPE: &str = include_str!("./test_recipe.cook");
const FRONTMATTER_RECIPE: &str = include_str!("./frontmatter_test_recipe.cook");
const COMPLEX_TEST_RECIPE: &str = include_str!("./complex_test_recipe.cook");

fn canonical(c: &mut Criterion) {
Expand All @@ -26,6 +27,11 @@ fn canonical(c: &mut Criterion) {
group.bench_with_input("meta", TEST_RECIPE, |b, input| {
b.iter(|| extended.parse_metadata(input).is_valid())
});
group.bench_with_input("frontmatter_meta", FRONTMATTER_RECIPE, |b, input| {
{
b.iter(|| extended.parse_metadata(input).is_valid())
}
});
}

fn extended(c: &mut Criterion) {
Expand Down

0 comments on commit b638d06

Please sign in to comment.