Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66246 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6442 invoked from network); 26 Feb 2013 15:25:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2013 15:25:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.45 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.45 mail-oa0-f45.google.com Received: from [209.85.219.45] ([209.85.219.45:45941] helo=mail-oa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D5/63-16132-1D3DC215 for ; Tue, 26 Feb 2013 10:25:06 -0500 Received: by mail-oa0-f45.google.com with SMTP id o6so5290238oag.4 for ; Tue, 26 Feb 2013 07:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=ZSflO4AAaGbtW5Wz10WofX767PM2nnNlcrqnT0udsNs=; b=wFOb/aKG90ZcJjbiNuAXrdgR+QZxqy9PGXjixcZG18nJkCmybFIXP2SpBLi3pMUCbd sf6GH5xFze7Xp7R56TuiFPZ5Ybm5aw3eOJ2TdzJYvqKLhzDiax1boCfbC+j/ZRmrizTx gQOnW6Uapje5uC6udZAGb79VMGd1NrEB/n+U2Qfqr5SxX1Ot5Sttl2g9+467DGpBPeRe qZuMQRzSxYrOOxMDOi3WtMz6qOIaN4EuAVuyjRh1ZgK9ju2fLsi6FzgYah3+OYrkYhxc anJLFLcZY8ZzE5wJ37qod+7gVR2quclKHmGlSF8KY+jqlIPlbRMAGRj0T3MI8GN5rm2V 6EMA== MIME-Version: 1.0 X-Received: by 10.60.170.20 with SMTP id ai20mr1833604oec.33.1361892303372; Tue, 26 Feb 2013 07:25:03 -0800 (PST) Received: by 10.182.49.136 with HTTP; Tue, 26 Feb 2013 07:25:03 -0800 (PST) In-Reply-To: References: Date: Tue, 26 Feb 2013 16:25:03 +0100 Message-ID: To: Mike Willbanks Cc: PHP Internals Content-Type: multipart/alternative; boundary=bcaec5540980f708e204d6a242be Subject: Re: [PHP-DEV] Add get_object_constants and get_class_constants From: nikita.ppv@gmail.com (Nikita Popov) --bcaec5540980f708e204d6a242be Content-Type: text/plain; charset=ISO-8859-1 On Tue, Feb 26, 2013 at 4:19 PM, Mike Willbanks wrote: > Hello All, > > Before drafting an RFC I would like to gauge interest in adding: > get_object_constants and get_class_constants > > Currently this can only be done through ReflectionClass which is far slower > than retrieving them directly from the constants table. Some simple > timings show that through reflection retrieving these values is 2-3 times > slower than providing a quick access function for retrieval. > > This also fits nicely amongst the current stack of: > get_object_vars, get_class_vars and get_class_methods > > These functions are commonly asked about on areas such as StackOverflow ( > > http://stackoverflow.com/questions/956401/can-i-get-consts-defined-on-a-php-class > ) > amongst other places on the net. > > I have already drafted up a PR with the changes and supplemental data: > https://github.com/php/php-src/pull/292 > > Regards, > > Mike > I don't quite see why we need this. The only argument seems to be performance and I'm not quite sure why performance would be relevant here. At least I can't imagine in what kind of code fetching the class constants is a bottleneck. Nikita --bcaec5540980f708e204d6a242be--