Means to speed up instantiation from large datasets? #549
-
I use spatie/laravel-data wherever possible in our codebase. However, recently I was trying to shape the output of a large collection of data ("large" being ~28,000 records) in the form of an array of plain PHP objects generated from a SQL query. If I simply loop over each and push PHP keyed arrays onto an empty array, the task is done in about 2.5 seconds. If I use laravel-data, it takes at least 16-20 seconds. I've tried using Is there any way to at least enforce the shape of the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Data has a lot of niceties, but that also creates a lot of overhead. We already have some performance tests in the package where we create huge collections. You're always welcome to send in a PR which speeds up the package but this is for us at the moment not the highest priority. |
Beta Was this translation helpful? Give feedback.
Data has a lot of niceties, but that also creates a lot of overhead. We already have some performance tests in the package where we create huge collections. You're always welcome to send in a PR which speeds up the package but this is for us at the moment not the highest priority.