Are algorithm benchmarks in PHP pointless?

GarrettTehMezzo

New Member
As PHP is simpler for me I wished to benchmark algorithms in it for fun, and I chose to do factorials.The recursive function completely flunked in speed when I got up to \[code\]80!\[/code\] compared to the iterative method, and it gradually skyrocketed upwards while iterative had a steady line, actually it is something like this (x = factorial, y = seconds):
mXQc2.png
But in C/Java (which I just implemented the test in) show the same results to be only 1-5% off from eachother, almost the same speed.Is it just useless to benchmark algorithms in this manner in scripting languages?EDIT: For NullUserException:\[code\]function factrec($x) { if($x <= 1) { return $x; } else { return $x * factrec($x - 1); }}\[/code\]
 
Back
Top