summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2005-11-05 14:37:40 +0000
committermurphy <murphy@rubychan.de>2005-11-05 14:37:40 +0000
commita05a7d11b1bc08f3817076dcb669bc6ef9d6d264 (patch)
tree27a0e78fcc2a8c0a6adb67c5a3b7b37047f226e4 /bench
parent4c01ff6ef9761ac4eb479dfc0d5ee3d25e9a2bc2 (diff)
downloadcoderay-a05a7d11b1bc08f3817076dcb669bc6ef9d6d264.tar.gz
bench/bench.rb: Added SilverCity benchmarking
demo/demo_load_encoder.rb enhanced demo/demo_load_scanner.rb added .outs added plugin.rb: Fixed load_all encoder.rb, scanner.rb adjusted helpers/word_list.rb: Fixed a bug in CaseIgnoringWordList.new TODO: Updated new ROADMAP coderay.rb: increased Version number added Version System documentation
Diffstat (limited to 'bench')
-rw-r--r--bench/bench.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/bench/bench.rb b/bench/bench.rb
index 38f8a19..f7c7388 100644
--- a/bench/bench.rb
+++ b/bench/bench.rb
@@ -129,13 +129,31 @@ Benchmark.bm(20) do |bm|
if compare
time = bm.report('Syntax') do
- c = Syntax::Convertors::HTML.for_syntax 'ruby'
+ c = Syntax::Convertors::HTML.for_syntax lang
+ puts 'No Syntax syntax found!' if c.tokenizer.is_a? Syntax::Default
+ begin
+ v = $VERBOSE
+ $VERBOSE = nil
+ raise
+ output = c.convert(data)
+ $VERBOSE = v
+ rescue => boom
+ output = boom.inspect
+ end
Dir.chdir(here) do
File.open('test.syntax.' + format, 'wb') do |f|
- f.write '<html><head><style>%s</style></head><body><div class="ruby">%s</div></body></html>' % [DATA.read, c.convert(data)]
+ f.write '<html><head><style>%s</style></head><body><div class="ruby">%s</div></body></html>' % [DATA.read, output]
end
end
- $file_created << " and test.syntax.#{format}"
+ $file_created << ", test.syntax.#{format}"
+ end
+ puts "\t%7.2f KB/sec" % ((@size / 1024.0) / time.real)
+
+ time = bm.report('SilverCity') do
+ Dir.chdir(here) do
+ `c:/Python/Scripts/source2html.pyo --generator=#{lang} example.#{lang} > test.silvercity.html`
+ end
+ $file_created << ", test.silvercity.#{format}"
end
puts "\t%7.2f KB/sec" % ((@size / 1024.0) / time.real)
end