mirror of
https://github.com/Wessel/nhl-levenshtein.git
synced 2026-06-05 23:55:45 +02:00
feat: Add console app to measure CPU and Memory performance
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
5
Typescript/console.ts
Normal file
5
Typescript/console.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { levenshteinRatio } from "./levenshteinRatio.ts";
|
||||
|
||||
for (let i = 0; i < 1000000; i++) {
|
||||
console.log(levenshteinRatio('test', 'kitten'));
|
||||
}
|
||||
Reference in New Issue
Block a user