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 / 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 / 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 / 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-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 / 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 / gist:4041188
Created November 8, 2012 20:05
Markup for Twig features and compiled
=== blocks.twig
{% block sidebar %}
Right
{% endblock %}
=== test-base.twig
<side>
{% block sidebar %}Sidebar{% endblock %}
</side>
@LionsAd
LionsAd / component.php
Created November 12, 2012 22:36
Theme Component Library - Draft
<?php
component('ordered_list',
array(
component('item', 'a', array('id' => 'id-a')),
'b',
'c'),
array('id' => 'x')
);
@LionsAd
LionsAd / cache-clear-all-d8.php
Created December 6, 2012 21:11
Drupal Flush all Caches in D8
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* The routines here dispatch control to the appropriate handler, which then
* prints the appropriate page.
*
* All Drupal code is released under the GNU General Public License.
@LionsAd
LionsAd / make-profiling-fun
Last active December 16, 2015 18:38
Make profiling Drupal's theme system fun!
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 47c99d9..30380f8 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -11,6 +11,7 @@
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Template\Attribute;
use Drupal\Core\Utility\ThemeRegistry;
+use Drupal\Component\PhpStorage\PhpStorageFactory;
@LionsAd
LionsAd / smartcache-plus-poc.diff
Created February 18, 2015 13:20
SmartCache++
diff --git a/core/lib/Drupal/Core/Render/Renderer.php b/core/lib/Drupal/Core/Render/Renderer.php
index 69e99a0..8bdf86a 100644
--- a/core/lib/Drupal/Core/Render/Renderer.php
+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -184,6 +184,11 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
$this->bubbleStack();
return $elements['#markup'];
}
+
+ // Store the cache ID for later comparison.