From 7d4fb4e6170103f0c23c55c6e2e85e7b58efc11f Mon Sep 17 00:00:00 2001 From: Wessel Date: Thu, 20 Mar 2025 10:06:04 +0100 Subject: [PATCH] feat: Add console app to measure CPU and Memory performance --- C#/Console/Program.cs | 4 +++- Haskell/app/Main.hs | 16 ++++++++++------ Typescript/console.ts | 5 +++++ 3 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 Typescript/console.ts diff --git a/C#/Console/Program.cs b/C#/Console/Program.cs index 4976139..2807956 100644 --- a/C#/Console/Program.cs +++ b/C#/Console/Program.cs @@ -1,3 +1,5 @@ using LevenshteinRatio; -Console.WriteLine(Levenshtein.Ratio("exampel", "example")); +for (int i = 0; i < 1000000; i++) { + Console.WriteLine(i + Levenshtein.Ratio("test", "kitten")); +} diff --git a/Haskell/app/Main.hs b/Haskell/app/Main.hs index 563a71f..94f0309 100644 --- a/Haskell/app/Main.hs +++ b/Haskell/app/Main.hs @@ -5,9 +5,13 @@ import Text.Format main :: IO () main = do - let source = "kitten" - target = "sitting" - - putStrLn $ format "Source\t{0}" [source] - putStrLn $ format "Target\t{0}" [target] - putStrLn $ format "Ratio\t{0}" [show (levenshteinRatio source target)] + repeatNTimes + 1000000 + (putStrLn + (format "{0}" [show (levenshteinRatio "test" "kitten")]) + ) + where + repeatNTimes 0 _ = return () + repeatNTimes n action = do + action + repeatNTimes (n-1) action \ No newline at end of file diff --git a/Typescript/console.ts b/Typescript/console.ts new file mode 100644 index 0000000..281a6c7 --- /dev/null +++ b/Typescript/console.ts @@ -0,0 +1,5 @@ +import { levenshteinRatio } from "./levenshteinRatio.ts"; + +for (let i = 0; i < 1000000; i++) { + console.log(levenshteinRatio('test', 'kitten')); +} \ No newline at end of file