Skip to content

Instantly share code, notes, and snippets.

View LionsAd's full-sized avatar

Fabian Franz LionsAd

  • LionsAd
  • Schweiz
View GitHub Profile
@LionsAd
LionsAd / gist:3954121
Created October 25, 2012 17:18
Backtrace
entity_get_controller('image_style')
entity_create('image_style', Array)
image_config_import_create('image.style.large', Object, Object)
call_user_func_array('image_config_import_create', Array)
module_invoke('image', 'config_import_create', 'image.style.large', Object, Object)
config_import_invoke_owner(Array, Object, Object)
config_install_default_config('module', 'image')
module_enable(Array, )
_install_module_batch('image', 'Image', Array)
call_user_func_array('_install_module_batch', Array)
@LionsAd
LionsAd / benchmark-twig-ra-opt.sh
Created October 25, 2012 14:09
Benchmark all twig branches against two baselines ...
#!/bin/bash
for branch in d8-core-1712444-core--rebase d8-core-1712444-twig-ra-opt--rebase d8-core-1712444-v1-ra-opt--rebase d8-core-1712444-v2-ra-opt--rebase d8-core-1712444-v3-ra-opt--rebase d8-core-1712444-twig-node--rebase
do
$HOME/benchmark-vs-baseline.sh "$branch" 508939efc2f7b twig-ra-opt 5088f8fb987c9 core
done
@LionsAd
LionsAd / index-perf.php
Created October 25, 2012 12:28
Drupal wrapped index.php
<?php
// set profiler namespace
$profiler_namespace = (!isset($_GET['namespace']))?'drupal-perf':$_GET['namespace'];
$profiler_extra = (!isset($_GET['extra']))?'':$_GET['extra'];
// @todo: This still needs devel module with xhprof enabled
$time_start = microtime( true );
@LionsAd
LionsAd / benchmark-vs-baseline.sh
Created October 25, 2012 12:25
Benchmark vs. Baseline
#!/bin/bash
base=''
branch=master
[ -n "$1" ] && branch=$1
shift
basedir=$(dirname $0)
@LionsAd
LionsAd / find-min-web.sh
Created October 25, 2012 11:37
Find fastest execution time
#!/bin/bash
#
# Syntax: find-min-web.sh <namespace> <loops>
MIN=1000000
NS='drupal-perf'
LOOPS=100
[ -n "$1" ] && NS=$1
[ -n "$2" ] && LOOPS=$2
@LionsAd
LionsAd / xhprof-check.php
Created October 25, 2012 11:35
Diff XHProf runs against each other
<?php
$run1 = $_SERVER['argv'][1];
$run2 = $_SERVER['argv'][2];
$extra = isset($_SERVER['argv'][3])?$_SERVER['argv'][3]:'';
$source = isset($_SERVER['argv'][4])?$_SERVER['argv'][4]:'drupal-perf';
include_once '/var/www/xhprof/xhprof_lib/utils/xhprof_lib.php';
include_once '/var/www/xhprof/xhprof_lib/utils/xhprof_runs.php';
include_once '/var/www/xhprof/xhprof_lib/display/xhprof.php';
@LionsAd
LionsAd / node.html.twig.autoescape.optimized.php
Created October 25, 2012 04:28
Auto Escaped Optimized Twig Compiled Template
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
@LionsAd
LionsAd / node.html.twig.autoescape.php
Created October 25, 2012 04:23
Auto Escaped Twig Compiled Template
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
@LionsAd
LionsAd / test-array-performance-reference.php
Created October 25, 2012 03:45
Test array performance in difference scenarios
<?php
require_once 'core/lib/Drupal/Core/Template/TwigReference.php';
use Drupal\Core\Template\TwigReference;
function getAttribute($val, $key) {
//$_GLOBALS['ref'] = &$val[$key];
return $val[$key];
}
@LionsAd
LionsAd / node.html.twig.optimized.php
Created October 25, 2012 03:27
Optimized compiled TwigTemplate
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;