During the workshop I followed I learned the following handy directive #time that can be used in F# Interactive.
Executing the #time directive will enable basic profiling.
Let’s try the code below in F# interactive(FSI):
This will produce the following output:
--> Timing now on
Real: 00:00:00.000, CPU: 00:00:00.000, GC gen0: 0, gen1: 0, gen2: 0
val strings : string [] = [|"Machine"; "Learning"; "with"; "F#"; "is"; "fun"|]
val lengths : int [] = [|7; 8; 4; 2; 2; 3|]>
We get the real time and CPU time, as well as some information about garbage collection in generations 0, 1 and 2.
To disable it again you can execute the #time directive another time.