August 18, 2011
by Sebastian
2 Comments

Distraction-free writing with FocusWriter

Recently, I needed to write lots of Text — my deploma thesis, FLOW3 documentation and internal documentation for our company. I recognized that I had some severe difficulties in staying focussed; I always knew some distractions I could do instead of writing.

I tried out several distraction-free writing tools; and the one I am using now is called FocusWriter. It’s open source, available for all platforms, actively maintained and can be customized to your needs. For me, it really helps keeping myself focused.

August 2, 2011
by Sebastian
4 Comments

Git Tip: merge –no-squash

Often, when I develop a feature, I push to a temporary repository on Github very frequently. As an example, for implementing Fluid caching, we did around 60 commits to the GitHub repository for implementing this feature.

However, when pushing it to the TYPO3 Review System, we only want a single commit instead of many. There are two ways  to archieve this, which I want to highlight here:

git rebase –interactive

If you have a quite linear history, you can do an interactive rebase, as described in this tutorial, and then squash all commits into a single one.

This works especially nice with a mostly-linear history.

The Problem: In-Between Merge Commits

While the above concept works nicely in many cases, in our example we had a non-linear history, as we merged updates from the official Fluid repository into our development branch.

Now, this meant I could not just use squash all my commits into one, but needed a different technique. When reading the man page of git merge, I found a solution:

git merge –no-squash

git checkout master
git merge --no-squash dev
# delete .git/MERGE_HEAD if it exists
git commit

The trick is to use git merge –no-squash, as it just updates the staging area but does not commit the merge yet. It thus gives you all changes; and by deleting the MERGE_HEAD file, git will commit all changes as single commit.

You of course loose connection to the intermediate commits in the dev branch then, so make sure to record at which point in the dev branch you merged back!

July 31, 2011
by Sebastian
4 Comments

Fluid — Static PHP Caching

 

On last Sunday, Bastian has arrived in Dresden for a code sprint to implement compilation of Fluid Templates to PHP code. This post explains first how we worked, and then shows what matters most: Results :-)

The Workflow

On the first evening, we mainly worked on setting up the environment and create a reliable profiling environment – next to spending a nice evening in Dresden, of course :-)

On Monday morning, we used our newly created benchmark framework and did some baseline measurements, which you see below. Our performance measurement microframework is based on XHProf, and implements a little GUI on top of XHProf which can be used to see different runs and optimizations on a single glance.

Profiling viewer

We mainly tested the following setups:

  • many objects
  • many forms
  • high nesting level
  • many partials

After the baseline measurements, we started with implementing the compilation phase — and after a few hours, we were successful in rendering our first compiled template! After that, we were able to work iteratively: Checking why a particular rendering is slow, identifying the bottle necks, and testing if our improvements helped.

Results

Numbers count most, and that’s why we want to share them with you. All numbers have been measured on my MacBook Pro 2.4 GHz Intel Core 2 Duo, with 4 GB RAM and a normal hard disk. Feel invited to test Fluid for yourself, making your own benchmarks.

The columns of the result table mean the following:

  • Instanciations: Number of object creations
  • Runtime: complete rendering time in seconds
  • Memory: Maximum taken memory in MB
The rows mean the following:
  • Before: before the optimization
  • BuildCache: this is the first run, when the template is not yet cached; and a cached representation is built.
  • Cached: all other runs after the first run are served from the cached template.

500 Objects

Testing setup: <f:for> loop over 500 objects.

Instanciations Runtime Memory
Before 2 165 0.59 1.15
BuildCache 149 0.42 1.9
Cached 73 0.12 0.8

5000 Objects

Testing setup: <f:for> loop over 5000 objects.

Instanciations Runtime Memory
Before 20165 5.6 1.46
BuildCache 149 3.8 1.65
Cached 73 1.15 1.07 

30 Forms

Testing setup: 30 times <f:form> with eight form elements.

Instanciations Runtime Memory
Before 14 479 1.06 14.94
BuildCache 4 653 0.85 6.06
Cached 2 223 0.34 7.27

recursive list – nesting level 6

Testing setup: seven nested <f:for> loops, yielding around 5 500 object accesses

Instanciations Runtime Memory
Before 13 987 3.76 1.98
BuildCache 247 2.76 2.17
Cached 73 0.80 1.05

recursive list – nesting level 7

Testing setup: seven nested <f:for> loops, yielding around 22 000 object accesses

Instanciations Runtime Memory
Before 54 986 15.25 4.01
BuildCache 268 11.62 4.21
Cached 73 3.24 2.25

1000 partials

Testing setup: rendering a single partial 1000 times

Instanciations Runtime Memory
Before 26 157 3.11 9.95
BuildCache 2 168 0.76 2.50
Cached 2 081 0.63 1.15

Improving Performance Based On Clean Design

The above performance improvements are absolutely transparent to the developer or the template designer; everybody using Fluid will benefit from these improvements.

Well, that’s not 100% true: We have one single change which is not backwards-compatible; however this change was not even in the public API, and we believe that the performance improvements are absolutely worth it!

We designed Fluid in a clean and object-oriented way — mainly using an object-based syntax tree for internal representation of a template. This enables performance optimizations as we did now; without changing the public API or the behavior of the parser.

This shows very nicely that performance optimizations based on a clean architecture and design are perfectly possible – and we’ll definitely do such a performance code sprint for FLOW3 at some point.

Closing Notes

Pair Programming in Dresden with Bastian was awesome — and at some point, we will definitely repeat it. Aside to programming, we also spent a nice time in Dresden, went climbing in the Saxon Swizerland, relaxing, discussing and having fun.

The whole optimization work has been financed by AOE Media, so we’d like to thank them very much for their generosity and support! I cannot express in words how much your sponsoring helped :-) It really made these optimizations possible.

I also hope that some other agencies follow your lead, financing other core developers when they need improvements on various parts of the core.

Thanks for Reading,
Sebastian

July 12, 2011
by Sebastian
0 comments

Developer Days 2011 waren wieder super!

Ich komme gerade wieder von den TYPO3 Developer Days 2011 in Sursee, welche – wie immer – sehr viel Spaß gemacht haben. Neben dem Kennenlernen vieler interessanter Leute stand im Vordergrund, in Workshops möglichst viel zu implementieren und umzusetzen.

Daher habe ich mit dem Extbase-Team einige Extbase-Workshops gehalten, die die Weiterentwicklung von Extbase sicherstellen sollen und Contributions erleichtern sollen.

Als erstes sichtbares Resultat wurde unter anderem das Wiki aufgeräumt, sowie Strategien für weitere Features diskutiert.

Ich freue mich schon aufs nächste Mal!

July 6, 2011
by Sebastian
0 comments

Verbessern von Aloha Editor

Gerade im Flugzeug von Wien nach Zürich zu den Developer Days — ein guter Zeitpunkt, kurz zurück zu schauen… Christopher und ich waren die letzte Woche bei Gentics, um am Aloha Editor zu arbeiten. Wir haben ein Feature namens “Blocks” implementiert; dies sind nicht-editierbare Bereiche einer Internetseite, welche trotzdem über das Aloha User Interface bearbeitet werden können. Da dies ein zentraler Bestandteil von TYPO3 Phoenix ist (jedes Plugin, jedes Content Element wird als Block realisiert), wurden wir von Haymo eingeladen, mit ihm das Konzept zu erarbeiten sowie zu implementieren.

Es war super! Wir haben nicht nur Blöcke implementiert, sondern auch das Wiki aufgeräumt, API verbessert, am Code Style gearbeitet, dokumentiert, Party gemacht, und auch einfach extrem viel Spaß gehabt… :-)

Hier noch ein cooles Video von Gentics:

PS: Wenn ihr mal in Wien seit, das phil ist ein echt gutes Café!

June 20, 2011
by Sebastian
0 comments

Welcome // Willkommen

Willkommen in diesem Blog!

Hier werden wir zu den Themen Sandstorm Media und unseren verwendeten Technologien bloggen, ganz speziell FLOW3, TYPO3, Fluid; aber auch andere interessante Dinge. Viel Spaß beim Lesen, wir sind gespannt auf eure Kommentare!

Wir wissen noch nicht genau, ob wir auf Deutsch doer Englisch bloggen, daher probieren wir einfach beides mal aus.

Welcome to this Blog!

Here, we will blog about our company, Sandstorm Media, and the technologies we use. Specially FLOW3, TYPo3 and Fluid will be highlighted; but also other interesting technology topics. Have fun reading, we’re curious about your comments!

We’re not yet decided if we do this blog in German or English, so that’s why we will blog in multiple languages in the beginning.