-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache time representation. #149
Conversation
I have improved algorithm and using this example i have benchmarked original and improved version in Linux VM using redirection to file (to avoid terminal performance problems). import chronicles, std/monotimes
const TestsCount = 6000000
proc testFoo() =
let start = getMonoTime()
for i in 0 ..< TestsCount:
info "Performance check", index = i
echo "It takes ", getMonoTime() - start
when isMainModule:
testFoo() Original version
Average performance = Improved version
Average performance = Performance boost 134.69% |
chronicles/log_output.nim
Outdated
let tmp = $sec | ||
res[1] = tmp[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let tmp = $sec | |
res[1] = tmp[0] | |
res[1] = '0' + char(sec) |
etc .. can avoid the memory allocations here
According to my benchmarks this gives 18% performance boost on Linux.
Latest version gives over 100% performance boost on Linux.