Created
March 24, 2011 02:12
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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