What's the largest (most complex) PHP algorithm ever implemented in a single monolithic PHP script?
- by Alex R
I'm working on a tool which converts PHP code to Scala. As one of the finishing touches, I'm in need of a really good (er, somewhat biased) benchmark.
By dumb luck my first benchmark attempt was with some code which uses bcmath extensively, which unfortunately is 1000x slower in Java, making the Scala code 22x slower overall than the original PHP.
So I'm looking for some meaningful PHP benchmark with the following characteristics:
The source needs to be in a single file.
I need it to be simple to setup - no databases, hard-to-find input files, etc.
Simple text input and output preferred.
It should not use features that are slow in Java (BigInteger, trigonometric functions, etc).
It should not use exoteric or dynamic PHP functions (e.g. no "eval" or "variable vars").
It should not over-rely on built-in libraries, e.g. MD5, crypt, etc.
It should not be I/O bound. A CPU-bound memory-hungry algorithm is preferred.
Basically, intensive OO operations, integer and string manipulation, recursion, etc would be great.
Thanks