From b638d06e8049a890174454e5d943ca9d3f9da5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20J=2E=20S=C3=A1nchez?= Date: Tue, 19 Nov 2024 16:49:28 +0100 Subject: [PATCH] add frontmatter benchmark --- benches/frontmatter_test_recipe.cook | 57 ++++++++++++++++++++++++++++ benches/parse.rs | 6 +++ 2 files changed, 63 insertions(+) create mode 100644 benches/frontmatter_test_recipe.cook diff --git a/benches/frontmatter_test_recipe.cook b/benches/frontmatter_test_recipe.cook new file mode 100644 index 0000000..ff0cdaa --- /dev/null +++ b/benches/frontmatter_test_recipe.cook @@ -0,0 +1,57 @@ +--- +servings: 4 +emoji: πŸ₯Ÿ +tags: warm, fried, starter +source: CooklangCLI Seed +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. \ No newline at end of file diff --git a/benches/parse.rs b/benches/parse.rs index 5ed114b..41b171a 100644 --- a/benches/parse.rs +++ b/benches/parse.rs @@ -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) { @@ -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) {