openfoodfacts / openfoodfacts-php

PHP wrapper for Open Food Facts
https://packagist.org/packages/openfoodfacts/openfoodfacts-php
MIT License
58 stars 34 forks source link

Improve performance of Document:class #25

Closed Dwarfex closed 3 years ago

Dwarfex commented 4 years ago

I noticed that the data representation of a Document::class is sorted everytime a read access happens on the object. For performance reasons, the sorting of the (product-) data (-array) should happen with a set/write into the object.

https://github.com/openfoodfacts/openfoodfacts-php/blob/49808014d335af6dbac3162effc85e4f460d9e39/src/Document.php#L57