REXML is dead. Long live Nokogiri.
Modify Maruku to use Nokogiri instead of REXML. Produces a 3-fold speedup in the #to_html method.
This commit is contained in:
parent
46da1f3aaf
commit
13a522525c
369 changed files with 1703 additions and 16342 deletions
29
vendor/plugins/maruku/miscs/test.rb
vendored
Normal file
29
vendor/plugins/maruku/miscs/test.rb
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
n=100
|
||||
$buffer = "blah "*n+"boh"+"beh"*n
|
||||
$index = n*5
|
||||
|
||||
def fun1(reg)
|
||||
r2 = /^.{#{$index}}#{reg}/
|
||||
r2.match($buffer)
|
||||
end
|
||||
|
||||
def fun2(reg)
|
||||
reg.match($buffer[$index, $buffer.size-$index])
|
||||
end
|
||||
|
||||
r = /\w*/
|
||||
a = Time.now
|
||||
1000.times do
|
||||
fun1(r)
|
||||
end
|
||||
|
||||
b = Time.now
|
||||
1000.times do
|
||||
fun2(r)
|
||||
end
|
||||
|
||||
c = Time.now
|
||||
|
||||
puts "fun1: #{b-a} sec"
|
||||
puts "fun2: #{c-b} sec"
|
Loading…
Add table
Add a link
Reference in a new issue