How to measure more percisely than milliseconds
8.6

How to measure more percisely than milliseconds

Lîm Tsú-thuàn <dannypsnl@gmail.com>

A common problem in Racket is that we can use time function to measure a codeblock’s spend time, but it only provides milliseconds, what if we want more percise result? Library monotonic stands for this problem, by using (current-monotonic-nanoseconds), we get nanoseconds.

raco pkg install monotonic

And we can get microseconds by current-inexact-milliseconds, it will return value like 1289513737015.418, where 1289513737015 is in milliseconds and 418 is in microseconds.