Req #62278 [Opn->Wfx]: Data structure optimized for table data

From: Date: Fri, 18 Jun 2021 09:10:29 +0000
Subject: Req #62278 [Opn->Wfx]: Data structure optimized for table data
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234476@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62278&edit=1 ID: 62278 Updated by: cmb@php.net Reported by: jasonmoo at me dot com Summary: Data structure optimized for table data -Status: Open +Status: Wont fix Type: Feature/Change Request Package: *Programming Data Structures PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This looks too special to me. Declaring a class for the record can be an alternative; otherwise Ds[1] may already provide the needful. If you stll feel that this would be a good feature addition, please pursue the RFC process[2]. [1] <https://pecl.php.net/package/ds> [2] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2012-06-09 21:53:00] cataphract@php.net Something like this has a much better chance of landing if you write an implementation for it. ------------------------------------------------------------------------ [2012-06-09 16:03:03] jasonmoo at me dot com Description: ------------ Hey. So it's not uncommon for a website to cache large database record sets in redis/memcache/etc and pull it out, filter it down, and present the remainder. However using an array of arrays has memory and speed disadvantages due to allocating more array buckets than needed and storing column names in every key of every row. I'm requesting an SPL data structure that would reduce memory and increase access time on large record sets. A recordset object could be initiated with an array of column names and optional row count. Records could be added/removed but each row would be an arrayobject- like object reflecting the column array. However this object could store the data as a simple array and reference the recordset for a column's location in that array. Initiating recordsets/records with counts gives the advantage of only allocating as much array buckets as needed. And only storing the column names in the recordset object removes the need to store and hash each column name on each record. The memory savings on larger sets should be significant as well as a nice speed boost. If this was adopted, making it available as a native structure in the *sql drivers would reduce the overhead on actually getting it out of the database to begin with. And a nice serialized format would reduce it's memory footprint in memcache/redis/etc as well. This is my first submission for a feature request, while I've been a php dev for ~12 years. Thanks! Jason ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62278&edit=1

« previous php.bugs (#234476) next »