rusti
rusti copied to clipboard
Add a way to time how long functions take to execute
e.g. In F# interactive you would use:
> #time;;
--> Timing now on
> let rec fib n = if n < 2 then 1 else fib (n-1) + fib(n-2);;
Real: 00:00:00.000, CPU: 00:00:00.000, GC gen0: 0, gen1: 0
val fib : n:int -> int
> fib 42;;
Real: 00:00:02.615, CPU: 00:00:02.612, GC gen0: 0, gen1: 0
val it : int = 433494437
Its a nice feature in F#, I thought it may be useful in rusti. Im not exactly sure how easy it would be to add?
That does look useful. It seems pretty straightforward to add as a rusti command. The only obvious impediment would be finding an operating system-independent means of measuring CPU time used over a span of real time.