Skip to content

Instantly share code, notes, and snippets.

@ferrous26
Created March 24, 2011 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrous26/884427 to your computer and use it in GitHub Desktop.
Save ferrous26/884427 to your computer and use it in GitHub Desktop.
compile/clean tasks that can be dropped into rakefile for compile speed comparisons
require 'rake/compiletask'
Rake::CompileTask.new(:fast_compile) do |t|
t.files = FileList["lib/**/*.rb"]
t.verbose = true
end
desc 'AOT compile source files'
task :slow_compile do
start_time = Time.now
FileList["lib/**/*.rb"].each do |source|
compiled_name = "#{source}o"
next if File.exists?(compiled_name) && (File.mtime(compiled_name) > File.mtime(source))
name = File.basename source
puts compiled_name
`macrubyc -C '#{source}' -o '#{compiled_name}'`
end
puts "Time taken for compile was: #{Time.now - start_time}"
end
desc 'Clean *.rbo files'
task :clean_rbo do
FileList["lib/**/*.rbo"].each do |bin|
puts "Removing #{bin}"
rm bin
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment