Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113418 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84184 invoked from network); 8 Mar 2021 16:38:22 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Mar 2021 16:38:22 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E66B71804B8 for ; Mon, 8 Mar 2021 08:30:08 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 8 Mar 2021 08:30:08 -0800 (PST) Received: by mail-il1-f170.google.com with SMTP id s1so9335393ilh.12 for ; Mon, 08 Mar 2021 08:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cd+nkBQ4Yrjvxu4a+eNlghghR58g2bKjmQNLfJJtyig=; b=d3YB3Mwu7DRRAXqT30ayaWWcFQbVnNKt3JIXHeRZPs2PYM+Pf4liQbkpFOY91TKWef e8VNs8MTOX1m7JJS/M7YWBOuMw4QtcScL6gi1mk9jQ6no2lNwnRdtlY7/bkPqQW6YJZ3 1/mGz5Zxp/+9A+cZXiGvsgQJ53XprfvvIQrFQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cd+nkBQ4Yrjvxu4a+eNlghghR58g2bKjmQNLfJJtyig=; b=kvHEuvE4j1CzGm0mEYGPuBFnh4HUGHtAXZ+erDXRCsBF7633D0rgoBXW8g62Z560Ia vx+/IvQ3enBXA7B3wyqtDP9Jm07aaxlgHHyfa+KW1+wWghzvC28RUd/HAxFReStzyE6K X80uU+PwNdJC9I2RVESmBhsHo8TAYV368L7Tkzh9+KAAQBYhVPfjlUUH3ypeSMgRLcha JHB60Hp9qPh81pnfpPyBQjUd1jS7kbJ+c/4xRrB1ue7gtr9dvarFCeqGW+LXy+1vokTz 20ysItexGrCIxhUTDxYF8ahWuWYcw/IBKqUigc7hOy+vuRkCId1M8V4yzkgwczVnPkOi w0Cg== X-Gm-Message-State: AOAM533OvpTc/uBcPN322WjIqvVcxsjBg0pUY/Mw0bx+ih/aHIiR1Tsy ZsnJ5ePSr3djWMvmnu/HXCmE9NkNpakZSDZ3Y9VpSQ== X-Google-Smtp-Source: ABdhPJyQYHsKJIQs9KTF5FqQIh2xgKU67JO/j1XLes9Y3lNk2PIO7ij6lXYdRhN4T1n3E2bP7hkRj80oG/jRh49Ot1U= X-Received: by 2002:a92:c26a:: with SMTP id h10mr21856571ild.234.1615221004324; Mon, 08 Mar 2021 08:30:04 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Reply-To: Levi Morrison Date: Mon, 8 Mar 2021 09:29:53 -0700 Message-ID: To: Levi Morrison Cc: internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Storing the lcname of symbols From: internals@lists.php.net ("Levi Morrison via internals") On Sun, Mar 7, 2021 at 10:21 AM Levi Morrison wrote: > > Hello! > > Most of PHP's symbols are case insensitive. This means extensions that > need to do things with function and method names end up lowercasing > and hashing the lowercased names, often having to do more memory > allocations too. Since case insensitive symbols is language dictated > behavior, it makes sense to expose the correctly cased symbols to > extensions. In PHP 8.0 (and possibly older, I did not check), the > engine is already interning the lowercased name of user defined > functions; it's just not made available to extensions. > > In my ideal world, we'd actually switch all symbols to be case > sensitive. However, that won't be happening for PHP 8 due to BC. > > So, instead, I propose adding an `.lcname` member (or some other name > indicating it's been normalized to the preferred PHP case) to at least > zend_op_array and zend_class_entry, but preferably for internal > functions too. Note that many internal functions will already be > lowercase, so the data can be shared. > > I could make this change in the main engine, but I strongly suspect it > will not play correctly with opcache. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > I just realized I didn't ask any specific questions. Oops: 1. Can anyone think of issues except increased memory due to increasing the size of the struct? Since the strings were previously interned, I don't think the strings themselves will have much effect on memory usage (but we can measure this). 2. Anyone else who thinks this would be useful?