Skip to content

Instantly share code, notes, and snippets.

View willf's full-sized avatar
✒️
pondering

Will Fitzgerald willf

✒️
pondering
View GitHub Profile
@willf
willf / f# stopwatch timing elapsed time.fs
Created April 30, 2010 13:05
Stopwatch elapsed timer in F#
open System
let sw = System.Diagnostics.Stopwatch()
sw.Start()
// some calculations
sw.Stop()
System.Console.WriteLine("Time elapsed: {0}", sw.Elapsed);;
// Time elapsed: 00:07:40.4029123
sw.Reset()
@willf
willf / stats.rb
Created September 16, 2009 03:21 — forked from mojombo/stats.rb
one pass through records (for mean and variance); annoyingly proper definition of median
# Run the given block +num+ times and then print out the mean, median, min,
# max, and stddev of the run. For example:
#
# irb> stats(10) { sleep(rand / 100) }
# mean: 5.99ms
# median: 6.76ms
# min: 1.49ms
# max: 9.28ms
# stddev: 2.54ms