From dfdf87cf07f4a9be5958e271f236987ac75ffbf8 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Wed, 20 Nov 2024 13:44:24 -0600 Subject: [PATCH] ms bin script --- bin/ms | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bin/ms diff --git a/bin/ms b/bin/ms new file mode 100644 index 0000000..6b7eada --- /dev/null +++ b/bin/ms @@ -0,0 +1,16 @@ +#!/usr/bin/ruby +# frozen_string_literal: true + +require "benchmark" + +class << Benchmark + def ms(&block) + 1000 * realtime(&block) + end +end + +system("") # warm up shelling out +cmd = ARGV.map { |arg| arg.empty? ? "\"\"" : arg }.join(" ") +ms = Benchmark.ms { system(cmd) } + +puts "#{ms}ms"