Skip to content

Instantly share code, notes, and snippets.

View mcuadros's full-sized avatar

Máximo Cuadros mcuadros

View GitHub Profile
@mcuadros
mcuadros / gist:9560576
Last active August 29, 2015 13:57
Mongator Benchmarks @ HHVM + Mongofill

Mongator Benchmarks @ HHVM + Mongofill

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

@mcuadros
mcuadros / gist:9604673
Last active August 29, 2015 13:57
stream_get_meta_data behavior

fopen

Code

<?php
$fp = fsockopen("www.example.com", 80);
if (!$fp) {
    echo "Unable to open\n";
 exit();
@mcuadros
mcuadros / gist:9633632
Created March 19, 2014 01:14
Doctrine Benchmarks @ HHVM + Mongofill

Doctrine @ MongoDB native driver 1.4.5 - PHP 5.5.9-1+sury.org~precise+1

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]

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);
@mcuadros
mcuadros / gist:10937820
Created April 16, 2014 22:06
pimple-hack vs pimple (HHVM vs PHP)

pimple-hack vs pimple

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.

The code

<?hh
type Example = (function(): string);
function main() {
$callback = function() {
return 'foo';
};
@mcuadros
mcuadros / gist:59209e4f47395828c297
Last active August 29, 2015 14:01
The Hitchhiker's Guide to the HHVM - Links
@mcuadros
mcuadros / gist:879cf48540ecd5dec6e6
Last active July 12, 2018 06:53
PHP vs PHP-CPP vs HHVM-HNI

#PHP vs PHP-CPP vs HHVM-HNI This is a small benchmark with the objective of compare the performance of PHP-CPP vs HNI.

Code

$a = [
    'key' => 'foo',
    'foo' => null,
    'a' => 2,
 'b' =&gt; 2.2,

REST-HAL endpoints

Summary

Motivation

The requirement of expose the domain via HTTP to other applications.

Services

# Default shell
set-option -g default-shell /usr/local/bin/fish
# Automatically set window title
#setw -g automatic-rename
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# split panel