I recently published my Measure-ScriptBlock function, where you can set how many times you want to take measurements of your code block, and get the mean value (average) calculated before output. That is all and well, but running it I could see that sometimes there would be some measurements that would spike and make the mean value higher than it really “should” be.

I started thinking about how it would be neat if I could calculate the trimmed mean instead. When calculating a trimmed mean, you remove (trim) a certain portion at the beginning and end of your (sorted) set, and then calculate the mean of the remaining values.

The idea is to use this function in my Measure-ScriptBlock function, but I thought I’d release it on it’s own as well. Might be others that can find it useful as well.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s