Code Monkey home page Code Monkey logo

phpbench's Introduction

PHPBench

Some PHP benchmarks - Very nice! WoW!

Based on phpbench/phpbench.

Installation

composer install

Usage

Run all tests

bin/bench benchmarks 

Run specific test

bin/bench benchmarks/GetFirstElementOfArray.php

Results

Get first element of array

+-------------------+---------+-------+
| subject           | mean    | diff  |
+-------------------+---------+-------+
| benchWithFirstKey | 0.048μs | 1.00x |
| benchWithCurrent  | 0.060μs | 1.27x |
| benchWithForeach  | 0.065μs | 1.36x |
| benchWithReset    | 0.107μs | 2.25x |
+-------------------+---------+-------+

Remove last element of tiny array (10 entries)

+------------------------------------+---------+-------+
| subject                            | mean    | diff  |
+------------------------------------+---------+-------+
| benchWithUnset                     | 0.117μs | 1.00x |
| benchWithArraySlice                | 0.135μs | 1.15x |
| benchWithArrayPop                  | 0.145μs | 1.24x |
| benchWithArrayReverseAndArrayShift | 0.253μs | 2.17x |
+------------------------------------+---------+-------+

Remove last element of large array (10000 entries)

+------------------------------------+----------+-------+
| subject                            | mean     | diff  |
+------------------------------------+----------+-------+
| benchWithArrayPop                  | 31.149μs | 1.00x |
| benchWithUnset                     | 32.279μs | 1.04x |
| benchWithArraySlice                | 33.904μs | 1.09x |
| benchWithArrayReverseAndArrayShift | 94.314μs | 3.03x |
+------------------------------------+----------+-------+

Create new object (thanks @nicolasbonnici)

+-------------------------------+---------+-------+
| subject                       | mean    | diff  |
+-------------------------------+---------+-------+
| benchWithArrayAndCast         | 0.086μs | 1.00x |
| benchWithAnonymousDeclaration | 0.088μs | 1.02x |
| benchWithJsonEncode           | 0.114μs | 1.32x |
| benchWithSdtClass             | 0.124μs | 1.44x |
+-------------------------------+---------+-------+

LICENSE

Licensed under the terms of the MIT License.

phpbench's People

Contributors

pgrimaud avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.