perbandingan waktu execution dengan php dan C

Posted by sphinx on February 8, 2008.

Iseng2 mau bandingin execution time dr file i/o menggunakan php dan C, sangat terlihat perdaan yang jauh sekali. Menggunakan C execution timenya 0.001s dan menggunakan PHP execution timenya 0.047s. (s = second = detik)

Dengan C:

[firman@muse ch]$ time ./test
#!/bin/ch
#include <stdio.h>
int main(void) {
printf("hello world\n");
return 0;
}
real    0m0.001s
user    0m0.000s
sys     0m0.001s

Source:

int main(void) {
printf(”%s\n”, file_get_contents(”a”) );
return 0;
}

Perhatian! file_get_contents() bukan fungsi standard ANSI C!

Dengan PHP:

[firman@muse ch]$ time php test.php
#!/bin/ch
#include <stdio.h>
int main(void) {
printf("hello world\n");
return 0;
}
real    0m0.047s
user    0m0.031s
sys     0m0.016s

Source:

<?php echo file_get_contents(”a”).”\n”; ?>

Bookmark this article!

BlogLinesDel.icio.usDiggFacebookFurlGoogleRedditSlashDotSphinnSpurl

SquidooStumbleUponTechnoratiYahoo

Make a Comment

Make A Comment: ( None so far )

blockquote and a tags work here.

Liked it here?
Why not try sites on the blogroll...

Get a Free Blog @ plinplan.net