Joshua Chamas wrote:
> The first of these runtime benchmarks is geared towards templating
> or embedded environments like ASP,PHP,Embperl,JSP,Mason ... the
> Hello World 2000 benchmark below has these characteristics:
>
> 2+ levels of code layering
> 1 rand() value per request
> 6 for loops executed
> 20 additions (float & integer)
> 10 lval assignments
> 200 variables inline
> 202+ chuncks of static html rendered
> Over 2900 byte template to parse
> Over 29K html output
This sounds great, but the code snippet you included makes it look like
the rand() value will have an effect on the number of bytes returned.
This is probably not a good idea, since that would allow many other
factors to affect the results. I suggest making sure that the benchmark
returns identical results on every platform and every execution.
> The next benchmark I'd like to set up might be called the
> Hello Database 10, which would likely fire off 1 insert, 8 selects,
> and 1 delete to a MySQL database. This test would be geared
> towards looking at web->database connectivity speed, & the relevant i/o
> for the various languages & environments. It would differentiate
> less between the various web apps, and more between the languages
> and databse drivers they run.
That also sounds cool. If possible, please try to write in such a way
that people running on other databases can easily customize it to test
their environment.
Of course ultimately coding styles usually affect performance more than
raw platform speed. PHP leans toward in-line code, Perl leans toward
modules and subroutine calls, and Java leans towards lots of objects and
more abstraction. However, you can use any of these styles on any of
these platforms so at least this will tell you if you're starting out
even on your tool of choice.
I volunteer to review code and offer tuning tips for the platforms I'm
familiar with.
- Perrin