Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112639 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 33561 invoked from network); 29 Dec 2020 17:29:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Dec 2020 17:29:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5EABF1804C4 for ; Tue, 29 Dec 2020 09:03:58 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12olkn2021.outbound.protection.outlook.com [40.92.23.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 29 Dec 2020 09:03:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bo0mT7l68PiUmUwUiaHH2lDTfXUZHVzjGMGdJEoxvCXGCHYIxwy19hWmIuZPsD5Gn7yaOOzhtN4Da7l0mdmILflGOoZQ7zZleilhnwXCxrC8I1LYrT+Dc110mA7SNql+6tYHxcO6RSZkxj/ft2Iwo3FJrZFsuVVbdZ/hTnj2vHBo3HJyKtR+XgfQwApHOVOcsPv4lvl0J9+jAxgVrVV4WU7fqVe7r+MwkzzydZHijrI4QnsZpOF6pJsElnLOmplREvFCBmEDv4Y5TmQkPJELPAnCcCel3hO6x+z88c34aAyQSWxw2igWPFDyPg0/KswBSPSydYfTFDMQYfbiWfH5jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d4z2e/6KHWqo6cjIczKsPBfyn1A1WFTHjLyzBcFoZOE=; b=OHGZ/lZKWqD1acDKHFx9PKq7sOg1GAz711+2dYLVwxbUftf8FaJGnNGXmL3aamoxaufoOs5vWxtbcKmseoXLbi6t02gC3ijQBLBStunJmUJgC7xMBN/9fwdtk/vqe9f4vyvwRb9DoondtzGBIfxs1wZ70AH98QTVEVEsNDxuYUY/Ycn/PqpWFqerCkM2IZf7KVtNwqnU4lLNdVSBOw9RpEH/gOObFpXU7ZqiqEKdnUNRxoUwJDRm/gshdM6XrbSwyaUegGh3R8OxUPvpnWWJZam53BIVVqT7Rl5TJNDbO7/W7woCxbQDduHZde48QAPxKzxlDsFVD+FIFjlNOTAANA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=d4z2e/6KHWqo6cjIczKsPBfyn1A1WFTHjLyzBcFoZOE=; b=qY2H7ga/1HiJF0NnB4tFuRQLeAbzFgLNaV3bfaRPws0LMnsfbgP83wox0FYjKHLJRdSvDfcCwRttkVq+bNdLJgHUVqnjcxpw46WXAuQA6A376nUYbBu5AkmYBuX+ye6/8Jjwe6fPYfdfZ/dpQx1I9isf+IOGTzLTYIU0C1/dyS8gUwZRzydxZlHthX0lW30n3r399fRkqON7d30s5TplbXEtoAVRuqnjUg+ve/lbqrjEdJrf58mWShYwvB3vLt6tv9FJyneI50alADN2uebEk4QPYLo86SMe+qW6I2MJiU08LfM4LrFn3j+OQvzk6kpLBoiSZq44MQywRJ5XrfWBpw== Received: from BN8NAM12FT021.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::4f) by BN8NAM12HT121.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.12; Tue, 29 Dec 2020 17:03:55 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com (2a01:111:e400:fc66::53) by BN8NAM12FT021.mail.protection.outlook.com (2a01:111:e400:fc66::391) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.12 via Frontend Transport; Tue, 29 Dec 2020 17:03:55 +0000 Received: from DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d]) by DM6PR07MB6618.namprd07.prod.outlook.com ([fe80::b4c4:dc11:5337:821d%4]) with mapi id 15.20.3700.031; Tue, 29 Dec 2020 17:03:55 +0000 To: "internals@lists.php.net" Thread-Topic: Proposal: Adding SplFixedArray->push() and SplFixedArray->pop() Thread-Index: AQHW3gIpWi0uEPQUo0aSmA8D1o9xDg== Date: Tue, 29 Dec 2020 17:03:55 +0000 Message-ID: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:F72ADFC7BC00F01142ED841826BF7D0CBBF7AA022D9C6FDC620254C613829F85;UpperCasedChecksum:D4386B74B85DD80B8D3F92CB7AAB4479067D246F80D35EDB08804F7085F370ED;SizeAsReceived:6837;Count:41 x-tmn: [NnW1LP1TvlwrQ8MFcpuOtQvYASyD4RWBHkPiGNpr0ovUliOkN7o2C8R3tbBTuvsG] x-ms-publictraffictype: Email x-incomingheadercount: 41 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 5fdfaa44-4d4d-42d3-e694-08d8ac1bba02 x-ms-traffictypediagnostic: BN8NAM12HT121: x-ms-exchange-minimumurldomainage: ruby-lang.org#7775 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4aNo2c68UWEXBdZLJ8j708E6JyXKhKqBUouqX1YUGUQ160wllMW/f1pFn+qOwpk4R/1QSwivuNPVKdsN1kspj5NyUPV2PP+hn9A7yqxN7UATzzvPxP9mwjnc1iDXJB6Bi6WjsbrIk86AAxvk8ZceWjqMxOAqmcnjlRg8mX2orQuEkSvvyyksbpMW6MkojnMQVhgnmmV/DvjkG8MolYu6dA0IdSW1aqkQaW9IotVuPLoxpA1zTABxx0ptkl/iBn1uWoRD8FUn2gOIBpVFIe3MTTXbpWwWm3s6M3MFjsyozC8= x-ms-exchange-antispam-messagedata: pUHvXBsCrbzE46FQbKopVuu3qAvaz1lrJTdMGKzV62Q/J9nyC4sgzSTu5EpJ8BJjik3HDAZpzVLCITeCIo/1xHuKMKWPjsAwY9wO6vA5rEPOw7yTPcyCJCz7uuPqIQL33n+JDL+uUlv0TRJUwC27oyrqj1mPXkFiBD+v6pkNUr7nLOjXg7a9MQzgDXxMXVjgFikzIgyZAafHODkge6LuDQ== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN8NAM12FT021.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 5fdfaa44-4d4d-42d3-e694-08d8ac1bba02 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Dec 2020 17:03:55.6552 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT121 Subject: Proposal: Adding SplFixedArray->push() and SplFixedArray->pop() From: tysonandre775@hotmail.com (tyson andre) Hi Internals,=0A= =0A= Currently, PHP doesn't have a built in memory-efficient array type with con= venient push, pop, and other operations, similar to a list/vector in other = languages.=0A= The closest built in in SPL is [SplFixedArray](https://www.php.net/manual/e= n/class.splfixedarray.php)=0A= =0A= https://www.php.net/manual/en/class.splstack.php uses a doubly linked list,= which uses much more memory and time than sequential memory.=0A= =0A= Contrary to the name and description in https://www.php.net/manual/en/class= .splfixedarray.php, the class is already resizable.=0A= The resize method is setSize - https://www.php.net/manual/en/splfixedarray.= setsize.php=0A= (increasing size is efficient - erealloc will extend the underlying array i= nto free memory if there is nothing in the way)=0A= =0A= Many programming languages have a memory-efficient list/vector type that ca= n be conveniently appended to and popped from.=0A= =0A= https://docs.python.org/3/tutorial/datastructures.html#more-on-lists=0A= https://www.cplusplus.com/reference/vector/vector/=0A= https://docs.ruby-lang.org/en/2.0.0/Array.html#method-i-push=0A= =0A= Is there any interest in adding this? It would be much more efficient to ad= d these in C.=0A= =0A= Thanks,=0A= - Tyson=