M
makoto kuwata
Hi, all.
I have released CGIExt 0.0.2.
http://rubyforge.org/projects/cgiext/
== About
'CGIExt' is a re-implementation of 'cgi.rb' in C extension.
It makes your web application faster.
Currently, not of all functions are implemented.
Notice: This module is still 'alpha release' and it's specification
may change in the future.
== Install
You need C compiler and Ruby's header file to compile CGIExt.
$ tar xzf cgiext-xxx.tar.gz
$ cd cgiext-xxx/
$ ruby extconf.rb
$ make
$ sudo make install
== Usage
The following is an example.
require 'cgi'
require 'erb'
require 'cgiext' # replaces functions automatically
If you require 'cgiext', the following functions are replaced by
faster implementation of CGIExt.
* CGI.escapeHTML()
* CGI.unescapeHTML()
* CGI.escape()
* CGI.unescape()
* CGI.rfc822_date()
* CGI.parse()
* ERB::Util.h()
* Erubis::XmlHelper.escape_xml()
* Tenjin::HtmlHelper.escape_xml()
Notice that these are replaced only when you have required that
module.
For example, if you have not required ERB before requiring 'cgiext',
ERB::Util.h() is not replaced.
== Benchmark
Try 'bench.rb' included in CGIExt archive.
This script tests functions of CGI and ERB.
### without CGIExt
$ ruby -s bench.rb -N=100000
user system total real
CGI.escapeHTML 5.110000 0.020000 5.130000 ( 5.188709)
ERB::Util.h 5.030000 0.020000 5.050000 ( 5.109625)
CGI.unescapeHTML 31.090000 0.090000 31.180000 ( 31.492502)
CGI.escape 4.630000 0.020000 4.650000 ( 4.679305)
CGI.unescape 3.780000 0.000000 3.780000 ( 3.800455)
CGI.rfc1123_date 2.020000 0.010000 2.030000 ( 2.049406)
CGI.parse 12.030000 0.030000 12.060000 ( 12.156096)
CGI.new 19.670000 0.050000 19.720000 ( 19.854737)
### with CGIExt
$ ruby -s bench.rb -N=100000 -cgiext
user system total real
CGI.escapeHTML 0.990000 0.010000 1.000000 ( 1.026906)
ERB::Util.h 0.960000 0.000000 0.960000 ( 0.971983)
CGI.unescapeHTML 1.200000 0.000000 1.200000 ( 1.210950)
CGI.escape 0.470000 0.000000 0.470000 ( 0.478267)
CGI.unescape 0.340000 0.000000 0.340000 ( 0.343116)
CGI.rfc1123_date 0.600000 0.010000 0.610000 ( 0.634919)
CGI.parse 1.990000 0.000000 1.990000 ( 2.003067)
CGI.new 8.990000 0.020000 9.010000 ( 9.084454)
The result shows that CGIExt makes functions of CGI and ERB
extremingly faster.
== License
Ruby's license
== Authoer
makoto kuwata <kwa(at)kuwata-lab.com>
== Bug reports
If you have bugs or questions, report them to kwa(at)kuwata-lab.com.
I have released CGIExt 0.0.2.
http://rubyforge.org/projects/cgiext/
== About
'CGIExt' is a re-implementation of 'cgi.rb' in C extension.
It makes your web application faster.
Currently, not of all functions are implemented.
Notice: This module is still 'alpha release' and it's specification
may change in the future.
== Install
You need C compiler and Ruby's header file to compile CGIExt.
$ tar xzf cgiext-xxx.tar.gz
$ cd cgiext-xxx/
$ ruby extconf.rb
$ make
$ sudo make install
== Usage
The following is an example.
require 'cgi'
require 'erb'
require 'cgiext' # replaces functions automatically
If you require 'cgiext', the following functions are replaced by
faster implementation of CGIExt.
* CGI.escapeHTML()
* CGI.unescapeHTML()
* CGI.escape()
* CGI.unescape()
* CGI.rfc822_date()
* CGI.parse()
* ERB::Util.h()
* Erubis::XmlHelper.escape_xml()
* Tenjin::HtmlHelper.escape_xml()
Notice that these are replaced only when you have required that
module.
For example, if you have not required ERB before requiring 'cgiext',
ERB::Util.h() is not replaced.
== Benchmark
Try 'bench.rb' included in CGIExt archive.
This script tests functions of CGI and ERB.
### without CGIExt
$ ruby -s bench.rb -N=100000
user system total real
CGI.escapeHTML 5.110000 0.020000 5.130000 ( 5.188709)
ERB::Util.h 5.030000 0.020000 5.050000 ( 5.109625)
CGI.unescapeHTML 31.090000 0.090000 31.180000 ( 31.492502)
CGI.escape 4.630000 0.020000 4.650000 ( 4.679305)
CGI.unescape 3.780000 0.000000 3.780000 ( 3.800455)
CGI.rfc1123_date 2.020000 0.010000 2.030000 ( 2.049406)
CGI.parse 12.030000 0.030000 12.060000 ( 12.156096)
CGI.new 19.670000 0.050000 19.720000 ( 19.854737)
### with CGIExt
$ ruby -s bench.rb -N=100000 -cgiext
user system total real
CGI.escapeHTML 0.990000 0.010000 1.000000 ( 1.026906)
ERB::Util.h 0.960000 0.000000 0.960000 ( 0.971983)
CGI.unescapeHTML 1.200000 0.000000 1.200000 ( 1.210950)
CGI.escape 0.470000 0.000000 0.470000 ( 0.478267)
CGI.unescape 0.340000 0.000000 0.340000 ( 0.343116)
CGI.rfc1123_date 0.600000 0.010000 0.610000 ( 0.634919)
CGI.parse 1.990000 0.000000 1.990000 ( 2.003067)
CGI.new 8.990000 0.020000 9.010000 ( 9.084454)
The result shows that CGIExt makes functions of CGI and ERB
extremingly faster.
== License
Ruby's license
== Authoer
makoto kuwata <kwa(at)kuwata-lab.com>
== Bug reports
If you have bugs or questions, report them to kwa(at)kuwata-lab.com.