PIMF vs. Silex

27. November 2015

1 Kommentar

This performance comparison was done by TechEmpower, Inc. CA. They made the benchmark of many web application frameworks executing fundamental tasks such as JSON serialization, database access, and server-side template composition. Each framework is operating in a realistic production configuration. Results are captured on physical hardware. The test implementations are largely community-contributed and all source is available at the GitHub repository.

In the following tests, TechEmpower have measured the performance of several web application platforms, full-stack frameworks, and micro-frameworks (collectively, „frameworks“). For more information, read the introduction, motivation, and latest environment details.


Peak: Dell R720xd dual Xeon E5-2660 v2 (40 HT cores) with 32 GB memory; database servers equipped with SSDs in RAID; switched 10-gigabit Ethernet


Current versions of: Linux, PHP-FPM, nginx on Linux, MySQL on Linux

Single query test

In this test, each request is processed by fetching a single row from a simple database table. That row is then serialized as a JSON response.

Best (bar chart)
Single query Best (bar chart)

Data table
Single query Data table

Single query Latency

Framework overhead
Single query Framework overhead

Multiple queries test

In this test, each request is processed by fetching multiple rows from a simple database table and serializing these rows as a JSON response. The test is run multiple times: testing 1, 5, 10, 15, and 20 queries per request. All tests are run at 256 concurrency.

20-queries (bar)
Multiple queries 20-queries (bar)

Data table
Multiple queries Data table

Multiple queries Latency

Framework overhead
Multiple queries Framework overhead

¬ geschrieben von gjerokrsteski in PIMF

Should a function have only one return statement?

13. August 2015

9 Kommentare

I would say that you can definitely have more than one return statement. Therefore I would like to suggest to:

1.) Minimize the number of returns in each routine. It’s harder to understand a routine if, reading it at the bottom, you’re unaware of the possibility that it returned somewhere above.

2.)Use a return when it enhances readability. In certain routines, once you know the answer, you want to return it to the calling routine immediately. If the routine is defined in such a way that it doesn’t require any cleanup, not returning immediately means that you have to write more code.

Question: Which of the functions shown below would you prefer and why?

Version 1:

function getTemplateId(array $config, $id)
    if (array_key_exists($id, $config)) {
        $templateId = $config[$id];
    } else {
        $templateId = 0;

    return $templateId;

Version 2:

function getTemplateId(array $config, $id)
    if (array_key_exists($id, $config)) {
        return $config[$id];

    return 0;

Please write your answer as a comment :-)

¬ geschrieben von gjerokrsteski in PHP Tricks und Tipps

PIMF Quick Starters

20. Januar 2014

0 Kommentare

Have you ever wished a PHP framework that perfectly adapts to your projects needs, your programming experience and your customers budget? A thin PHP framewrok with less implementing rools and easy to learn how to use it? PIMF is about to satisfy your demands! Den ganzen Beitrag lesen.

¬ geschrieben von gjerokrsteski in News und Trends, PHP Tricks und Tipps, PIMF

Powered by Wordpress • Abonniere den RSS Feed