From bba46e3ab4c85879387c89a5b6df12fe92b0ff09 Mon Sep 17 00:00:00 2001 From: Kasper Date: Fri, 13 Nov 2020 17:10:56 +0100 Subject: [PATCH] Fixed readme stating performance is over 1000x worse than it is --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bab7b7f..a2779c3 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,9 @@ round(sqrt(2)^4)! liters cpc Uses 128-bit Decimal Floating Point (d128) numbers instead of Binary Coded Decimals for better accuracy. The result cpc gives will still not always be 100% accurate. I would recommend rounding the result to 20 decimals or less. ## Performance -In my case, I can expect `eval()` to take 100-200ms, and this scales pretty alright. However, putting numbers with a lot of digits into functions result in pretty poor performance. `log(e)` is one of the worst, and takes 500ms for me. +It's pretty fast and scales well. In my case, `eval()` usually runs under 0.1ms. The biggest performance hit is functions like `log()`. `log(12345)` evaluates in 0.12ms, and `log(e)` in 0.24ms. + +To see how fast it is, you can pass the `--debug` flag in CLI, or the `debug` argument to `eval()`. ## Errors cpc returns `Result`s with basic strings as errors. Just to be safe, you may want to handle panics (You can do that using `std::panic::catch_unwind`).