Hacker News new | ask | show | jobs
by pedro93 4541 days ago
I don't think so.

Using pure PHP, you need to load a lot of class files. and function calls, method calls, hash find are pretty slow in pure PHP.

- First of all, while using C extension, you don't need to reload these php class files again and again. it reduces the class loading overhead.

- Seconds, looping and string comparison is pretty fast in C. it's because in pure PHP, it duplicates the string when calling functions/methods in the runtime.

- Third, there are a lot of spaces to optimize the code in C rather than in pure php.

- Last, pure PHP consumes a lot of memory, but in C extension, the memory footprint is pretty small.