Just as a learning practice, i made this port of pimple for hack, this are the results of my little benchmarks based on 1 million of iterations.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?hh | |
type Example = (function(): string); | |
function main() { | |
$callback = function() { | |
return 'foo'; | |
}; |
void bsonToMongoId(bson_iter_t* iter, Array* output) {
const bson_oid_t* oid = bson_iter_oid(iter);
char id[25];
bson_oid_to_string(oid, id);
TypedValue ret;
Class* cls = Unit::loadClass(s_MongoId.get());
ObjectData* obj = ObjectData::newInstance(cls);
Doctrine\Benchmarks\InsertingEvent
Method Name Iterations Average Time Ops/second
--------------------- ------------ -------------- -------------
simpleDocument : [400 ] [0.0039921021461] [250.49459]
complexDocument : [400 ] [0.0344979619980] [28.98722]
complexNestedDocument: [400 ] [0.5473231738806] [1.82707]
Mongator is a simple MongoDB ODM to claims to be 3x faster than Doctrine, now thanks to Mongofill a pure PHP implementation of MongoDB driver, is possible run this package under HHVM.
The benchmarks, are based on athletic.
The native version uses the standard mongo driver, and HHVM is running the lastest mastver version with Mongofill ae5c155 + bson-hni 0.0.1
A bencmarks of a plain version of mongofill can be found at https://gist.github.com/mcuadros/9551290
Mongofill\Benchmarks\BsonEvent
Method Name Iterations Average Time Ops/second
------------------- ------------ -------------- -------------
simpleEncode : [10,000 ] [0.0000005092382] [1,963,717.40250]
simpleNestedEncode : [10,000 ] [0.0000507833719] [19,691.48487]
complexEncode : [10,000 ] [0.0000015980959] [625,744.67768]
complexNestedEncode: [10,000 ] [0.0001292291880] [7,738.18992]
simpleDecode : [10,000 ] [0.0000009249926] [1,081,089.77498]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"class": [ | |
"discovery", | |
"product" | |
], | |
"title": "A. SAUVAGE royal panama cut away collar shirt grey", | |
"properties": { | |
"id": "527a355f1a9075a5778b4585", | |
"status": "published", | |
"visible": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcuadros@mcuadros-air /t/h/hhvm-HHVM-2.2> make test | |
[ 0%] [ 0%] Built target sqlite3 | |
Generating systemlib.php | |
[ 1%] Built target double-conversion | |
[ 9%] Built target mbfl | |
[ 9%] Built target afdt | |
[ 10%] Built target timelib | |
[ 10%] Built target lz4 | |
[ 10%] Built target hphp_parser | |
[ 11%] Built target neo |
http://www.phpgolf.org/challenge/99-Bottles
<?$w=' on the wall';$c=' bottle';$p=$c.s;$b=' of beer';for($v=99;$v>0;print"$r$w, $r.\n".(--$v?"Take one down and pass it around, $v".($v>1?$p:$c)."$b$w.":"Go to the store and buy some more, 99$p$b$w.")."\n\n")$r=$v.($v>1?$p:$c).$b;