gustafn
committed
on 17 Aug 15

ad_proc reform:
- use nsf::proc for defining ad_procs, when nsf::proc is available
- nsf::proc is part of the environment of XOTcl2 and pro… Show more

ad_proc reform:

- use nsf::proc for defining ad_procs, when nsf::proc is available

- nsf::proc is part of the environment of XOTcl2 and provides

 an efficient, C-implemented argument parser that can replace

 the scripted *__arg_parser of OpenACS.

- The benefits are performance and reduced memory consumption.

 * Simple functions (where the calling overhead was a large

   part of the execution times can become several times faster

   (e.g. db_name is 3x faster, cookie handling is 2x faster),

   for functions with much db-activities the percentage will

   be less.

 * The memory consumption (RSS) of a site like OpenACS.org

   is reduced by about 15%.

NEW (with nsf::proc)

::ad_get_cookie x: 10.93 microseconds per iteration

::ad_get_cookie ad_session_id: 21.95 microseconds per iteration

::dt_systime: 24.89 microseconds per iteration

::db_name:  8.70 microseconds per iteration

::db_string dbqd.null.g "select version() from dual": 316.66 microseconds per iteration

::ad_convert_to_html "hello world": 102.29 microseconds per iteration

OLD (without nsf::proc)

::ad_get_cookie x:  19.42 microseconds per iteration

::ad_get_cookie ad_session_id:  30.10 microseconds per iteration

::dt_systime:  27.55 microseconds per iteration

::db_name:  32.28 microseconds per iteration

::db_string dbqd.null.g "select version() from dual": 366.69 microseconds per iteration

::ad_convert_to_html "hello world": 160.51 microseconds per iteration

======================================================================

proc mtime cmd {set c 5000

   set t [time [list time $cmd $c]];

   regexp {^(-?[0-9]+) +} $t _ mS1;

   set ms [expr {$mS1*1.0/$c}];

   return "[format %6.2f $ms] microseconds per iteration"

}

set tests {

   {::ad_get_cookie x} {::ad_get_cookie ad_session_id} {::dt_systime}

   {::db_name} {::db_string dbqd.null.g "select version() from dual"}

   {::ad_convert_to_html "hello world"}

}

foreach t $tests {append ::_ $t ": " [mtime $t] \n}

set ::_

======================================================================

Show less