Skip to content

Instantly share code, notes, and snippets.

@Athari
Last active February 27, 2016 22:15
Show Gist options
  • Save Athari/1d001fde76f86f219c23 to your computer and use it in GitHub Desktop.
Save Athari/1d001fde76f86f219c23 to your computer and use it in GitHub Desktop.
LINQ for PHP comparison: YaLinqo vs Ginq vs Pinq performance (see https://github.com/Athari/YaLinqoPerf)
Iterating over 1000 ints
------------------------
PHP [for] 0.00006 sec x1.0 (100%)
PHP [array functions] 0.00011 sec x1.8 (+83%)
YaLinqo 0.00022 sec x3.7 (+267%)
Ginq 0.00077 sec x12.8 (+1183%)
Pinq 0.00040 sec x6.7 (+567%)
Generating array of 1000 integers
---------------------------------
PHP [for] 0.00022 sec x1.2 (+22%)
PHP [array functions] 0.00018 sec x1.0 (100%)
YaLinqo 0.00039 sec x2.2 (+117%)
Ginq 0.00109 sec x6.1 (+506%)
Pinq 0.00054 sec x3.0 (+200%)
Generating lookup of 1000 floats, calculate sum
-----------------------------------------------
PHP 0.00124 sec x1.0 (100%)
YaLinqo 0.00381 sec x3.1 (+207%)
YaLinqo [string lambda] 0.00403 sec x3.3 (+225%)
Ginq 0.01390 sec x11.2 (+1021%)
Pinq * Not implemented
Counting values in arrays
-------------------------
PHP [for] 0.00023 sec x1.0 (100%)
PHP [arrays functions] 0.00052 sec x2.3 (+126%)
YaLinqo 0.00056 sec x2.4 (+143%)
YaLinqo [string lambda] 0.00059 sec x2.6 (+157%)
Ginq 0.00129 sec x5.6 (+461%)
Pinq 0.00233 sec x10.6 (+959%)
Counting values in arrays deep
------------------------------
PHP [for] 0.00064 sec x1.0 (100%)
PHP [arrays functions] 0.00323 sec x5.0 (+405%)
YaLinqo 0.00798 sec x12.5 (+1147%)
Ginq 0.01416 sec x22.1 (+2113%)
Pinq 0.03600 sec x55.4 (+5438%)
Filtering values in arrays
--------------------------
PHP [for] 0.00049 sec x1.0 (100%)
PHP [arrays functions] 0.00072 sec x1.5 (+47%)
YaLinqo 0.00094 sec x1.9 (+92%)
YaLinqo [string lambda] 0.00094 sec x1.9 (+92%)
Ginq 0.00296 sec x6.4 (+543%)
Pinq 0.00260 sec x5.7 (+465%)
Filtering values in arrays deep
-------------------------------
PHP [for] 0.00514 sec x1.0 (100%)
PHP [arrays functions] 0.00739 sec x1.4 (+44%)
YaLinqo 0.01556 sec x3.0 (+203%)
YaLinqo [string lambda] 0.01750 sec x3.4 (+240%)
Ginq 0.03312 sec x6.6 (+556%)
Pinq 0.04571 sec x9.1 (+805%)
Sorting arrays of strings
-------------------------
PHP 0.02152 sec x1.0 (100%)
YaLinqo 0.02228 sec x1.0 (+4%)
YaLinqo [sort flags] 0.02257 sec x1.0 (+5%)
YaLinqo [callback] 0.03883 sec x1.8 (+80%)
Ginq 0.04100 sec x1.9 (+91%)
Pinq * Not implemented
Sorting arrays of objects
-------------------------
PHP [multisort] 0.00013 sec x1.0 (100%)
PHP [usort] 0.00035 sec x2.7 (+169%)
YaLinqo 0.00027 sec x2.1 (+108%)
YaLinqo [string lambda] 0.00031 sec x2.4 (+138%)
YaLinqo [sort flags] 0.00032 sec x2.5 (+146%)
Ginq 0.00349 sec x26.8 (+2585%)
Ginq [property path] 0.01695 sec x130.4 (+12938%)
Pinq 0.00122 sec x9.4 (+838%)
Joining arrays
--------------
PHP 0.00021 sec x1.0 (100%)
YaLinqo 0.00065 sec x3.1 (+210%)
YaLinqo [string lambda] 0.00070 sec x3.3 (+233%)
Ginq 0.00103 sec x4.9 (+390%)
Ginq [property path] 0.00200 sec x9.5 (+852%)
Pinq 0.00902 sec x41.0 (+4000%)
Aggregating arrays
------------------
PHP [for] 0.00059 sec x1.0 (100%)
PHP [array functions] 0.00162 sec x2.7 (+175%)
YaLinqo 0.00190 sec x3.2 (+222%)
YaLinqo [string lambda] 0.00233 sec x3.9 (+295%)
Ginq 0.00641 sec x10.9 (+986%)
Ginq [property path] 0.03927 sec x66.6 (+6556%)
Pinq 0.01568 sec x27.0 (+2603%)
Aggregating arrays custom
-------------------------
PHP [for] 0.00006 sec x1.0 (100%)
PHP [array functions] 0.00033 sec x5.5 (+450%)
YaLinqo 0.00044 sec x7.3 (+633%)
YaLinqo [string lambda] 0.00055 sec x9.2 (+817%)
Ginq 0.00044 sec x7.3 (+633%)
Pinq 0.00415 sec x69.2 (+6816%)
Process data from ReadMe example
--------------------------------
PHP [multisort] 0.00220 sec x1.0 (100%)
PHP [usort] 0.00660 sec x3.0 (+200%)
YaLinqo 0.00560 sec x2.5 (+155%)
YaLinqo [string lambda] 0.00580 sec x2.6 (+164%)
Ginq 0.07820 sec x35.5 (+3454%)
Pinq 0.02720 sec x12.4 (+1136%)
Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment