Skip to content

Commit 238711b

Browse files
committed
README.md updated
1 parent ff64bd7 commit 238711b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,22 @@ $intArray[] = 5;
3333
$intArray = new intArray([1, 'a', 3, 4]);
3434
$intArray[] = 'a';
3535
```
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+

0 commit comments

Comments
 (0)