File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -33,3 +33,22 @@ $intArray[] = 5;
33
33
$intArray = new intArray([1, 'a', 3, 4]);
34
34
$intArray[] = 'a';
35
35
```
36
+
37
+ ### Performance consideration
38
+ Compared to the parent class [ ArrayObject] ( http://php.net/manual/en/class.arrayobject.php ) typed arrays are slower on writing
39
+ approximately from 15x to 20x. The slowness due to not native ` __construct() ` and not native ` offsetSet() ` .
40
+ Other operations do not have a speed difference with the native ArrayObject.
41
+ ``` php
42
+ use Linna\intArray;
43
+
44
+ //slower from 15x to 20x.
45
+ $intArray = new intArray([1, 2, 3, 4]);
46
+ $intArray[] = 5;
47
+
48
+ //other operations, fast as native.
49
+ //for example:
50
+ $arrayElement = $intArray[0];
51
+ $elements = $intArray->count();
52
+ $array = (array) $intArray;
53
+ ```
54
+
You can’t perform that action at this time.
0 commit comments