From c584e36cd4e2ee947a584927be5159863d8943b1 Mon Sep 17 00:00:00 2001 From: krymtkts Date: Thu, 23 Jan 2025 23:39:41 +0900 Subject: [PATCH] Add benchmark for pocof event loop using dictionary input. --- src/pocof.Benchmark/Benchmarks.fs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pocof.Benchmark/Benchmarks.fs b/src/pocof.Benchmark/Benchmarks.fs index ef62aa0..579486c 100644 --- a/src/pocof.Benchmark/Benchmarks.fs +++ b/src/pocof.Benchmark/Benchmarks.fs @@ -292,3 +292,21 @@ type PocofBenchmarks2() = use buff = Screen.init (fun _ -> rui) (fun _ -> Seq.empty) config.Layout prompt // TODO: is Consumer.Consume the right way for this benchmark? Pocof.interact config state buff publishEvent __.Objects |> consumer.Consume + + [] + member __.interact_dict() = + let rui = new MockRawUI(60, 30, __.Keys) + + let config: InternalConfig = + { NotInteractive = true + Layout = Layout.TopDown + Keymaps = Keys.defaultKeymap + WordDelimiters = ";:,.[]{}()/\\|!?^&*-=+'\"–—―" + Prompt = prompt + PromptLength = prompt |> String.length + Properties = [] + PropertiesMap = Map [] } + + use buff = Screen.init (fun _ -> rui) (fun _ -> Seq.empty) config.Layout prompt + // TODO: is Consumer.Consume the right way for this benchmark? + Pocof.interact config state buff publishEvent __.Dicts |> consumer.Consume