Changeset 300
- Timestamp:
- 04/18/2008 16:34:02 (7 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 modified
-
Rakefile (modified) (3 diffs)
-
ext/redcloth_scan/extconf.rb (modified) (1 diff)
-
extras/ragel_profiler.rb (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Rakefile
r297 r300 12 12 REV = `svn info`[/Revision: (\d+)/, 1] rescue nil 13 13 VERS = ENV['VERSION'] || "3" + (REV ? ".#{REV}" : "") 14 CLEAN.include ['ext/redcloth_scan/*.{bundle,so,obj,pdb,lib,def,exp }', 'ext/redcloth_scan/Makefile',15 '**/.*.sw?', '*.gem', '.config']14 CLEAN.include ['ext/redcloth_scan/*.{bundle,so,obj,pdb,lib,def,exp,c,o,xml}', 'ext/redcloth_scan/Makefile', '**/.*.sw?', '*.gem', '.config'] 15 CLOBBER.include ['lib/*.{bundle,so,obj,pdb,lib,def,exp}'] 16 16 17 17 desc "Does a full compile, test run" … … 125 125 126 126 ["#{ext}/redcloth_scan.c","#{ext}/redcloth_inline.c"].each do |name| 127 @code_style ||= "T0" 127 128 source = name.sub(/\.c$/, '.rl') 128 129 file name => [source, "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do 129 130 @ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i} 130 131 if @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 1) 131 sh %{ragel #{source} - G2-o #{name}}132 sh %{ragel #{source} -#{@code_style} -o #{name}} 132 133 else 133 134 STDERR.puts "Ragel 6.1 or greater is required to generate #{name}." … … 213 214 end 214 215 end 216 217 RAGEL_CODE_GENERATION_STYLES = { 218 'T0' => "Table driven FSM (default)", 219 'T1' => "Faster table driven FSM", 220 'F0' => "Flat table driven FSM", 221 'F1' => "Faster flat table-driven FSM", 222 'G0' => "Goto-driven FSM", 223 'G1' => "Faster goto-driven FSM", 224 'G2' => "Really fast goto-driven FSM" 225 } 226 227 task :optimize do 228 require 'extras/ragel_profiler' 229 results = [] 230 RAGEL_CODE_GENERATION_STYLES.each do |style, name| 231 @code_style = style 232 profiler = RagelProfiler.new(style + " " + name) 233 234 # Hack to get everything to invoke again. Could use #execute, but then it 235 # doesn't execute prerequisites the second+ time 236 Rake::Task.tasks.each {|t| t.instance_eval "@already_invoked = false" } 237 238 Rake::Task['clobber'].invoke 239 240 profiler.measure(:compile) do 241 Rake::Task['compile'].invoke 242 end 243 profiler.measure(:test) do 244 Rake::Task['test'].invoke 245 end 246 profiler.ext_size(ext_so) 247 248 end 249 puts RagelProfiler.results 250 end -
trunk/ext/redcloth_scan/extconf.rb
r274 r300 3 3 $CFLAGS << " -O0 " # do not optimize (takes too much memory and performance gain is negligeable) 4 4 5 dir_config("redcloth_scan") 6 have_library("c", "main") 5 ### It seems to work fine without these 6 # dir_config("redcloth_scan") 7 # have_library("c", "main") 7 8 8 9 create_makefile("redcloth_scan")