Add bin/lineprof

This commit is contained in:
Takashi Kokubun 2015-10-31 12:16:56 +09:00
parent 5c6d7303d1
commit 70e2043e2a
1 changed files with 26 additions and 0 deletions

26
bin/lineprof Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env ruby
require 'bundler/setup'
require 'hamlit'
require 'lineprof'
require 'tempfile'
require 'thor'
class CLI < Thor
desc 'compile HAML', 'Benchmark compile'
def compile(file)
haml = File.read(file)
Lineprof.profile(/./) do
100.times { Hamlit::Engine.new.call(haml) }
end
end
private
def method_missing(*args)
return super if args.length > 1
compile(args.first.to_s)
end
end
CLI.start