[asterisk-users] Benchmarking AGI performance in C, PHP, and Perl

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Jul 12 03:15:35 CDT 2011


On Mon, Jul 11, 2011 at 02:29:25PM -0700, Steve Edwards wrote:

> The second AGI, 'neutered-agi' is an AGI of 'production length' (around  
> 1,600 lines) and supporting access to a MySQL database. The AGI is of  
> 'production length' but still exits after reading the AGI environment  
> variables because we are measuring program startup time.

Perl's startup time also depends on the modules you load:

The following is a simple loop that runs a perl program doing nothing
(executing an empty statement) but firt loading a different set of
modules for the task. The loop repeats it 1000 times:

# No extra modules:
$ time for i in `seq 1000`; do perl  -e ''; done
real    0m5.093s
user    0m1.676s
sys     0m2.524s

# Asterisk::AGI:
$ time for i in `seq 1000`; do perl -MAsterisk::AGI -e ''; done
real    0m9.400s
user    0m6.368s
sys     0m2.060s

# MySQL access:
$ time for i in `seq 1000`; do perl -MDBI -MDBD::mysql -e ''; done
real    0m40.964s
user    0m33.122s
sys     0m5.416s

# Asterisk::AGI and MySQL access:
$ time for i in `seq 1000`; do perl -MAsterisk::AGI -MDBI -MDBD::mysql -e ''; done
real    0m45.898s
user    0m36.798s
sys     0m6.048s

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list