Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111084 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 40183 invoked from network); 21 Jul 2020 06:05:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 21 Jul 2020 06:05:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 13A721804CD for ; Mon, 20 Jul 2020 21:59:56 -0700 (PDT) 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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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, 20 Jul 2020 21:59:55 -0700 (PDT) Received: by mail-ot1-f41.google.com with SMTP id 18so14113137otv.6 for ; Mon, 20 Jul 2020 21:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hb8TugWAX5EafwRXl6r6Lq3yAHdji86nFrTZavE+xI8=; b=Ag5W7ursjooEnLCm9HDGHayq5KkXkP09YOT33vxSZvh63zMnRltTePQNgV6/iYC5TJ pYZKERBoSMGXhVkY/m2B2JChmmaeglcgzzlEzkmvrN15uneRYomhlfD819SX6VDz1q8p 0gKMG1OhLd671qyK4cqiDosy0ZcA4YDhkS+RaQArVHi82Q4d7aKPPsnIZgT6w3J0zOnq H4zpyU9Fl8C6LCH+o/Z0Wx8yPCjiG8yDUMXDic2VKhH7Xsh8N31cT2Y0mdlPr0Cr4Ba2 O7j70TPySZ09rRYiYxf3NDz1n7lny5Ypc6ZK5qrKGGfk0iajBtmQMAARkr022BH17VYB miEQ== 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=hb8TugWAX5EafwRXl6r6Lq3yAHdji86nFrTZavE+xI8=; b=mGapSv6Wo9+/MNiU9gFOghdlhgo+GD6dlA10v735TmoRAi8R2TbwvzP4Z5O38lQ8s4 cHI3wZwrNbA3mGD1UoLsPV56fNNGd8JNb/lft6k0WWmPAYgklJ5pK3BFhqv/vCYnWO/v O3WK8N7Y8mIfwoFHeVDl6vRABDHisk/QB2bbw1V+YziKP5RBGX0TZkl/PC/Ar1VKSKT6 ryTdt1mfOrULOybgvxyutEpX4kkjvPxRW/MaC3C/VgpKNUzhfY1VdSi93vhCUnBF8NuQ cDLceHT8FQPk6/bfceVEvUWGYKj/AzJnQnd04tN06t+o3XtNdpxE74Xq2lKiIg6SpHVb VhWQ== X-Gm-Message-State: AOAM530luJnAInX9v83QXXpzcItY/s7+1TUkBDAe4Yh32eB+cFhnXcfE 6tESXyJ706nEcUG7BSaDYpO5RAEXfPIrAkB+fuk= X-Google-Smtp-Source: ABdhPJxkYtICZPH5AEQiORI84lwhRrgawYa02r6t+4pnG4F8V9LdE60SD2TVEFGU7B7Iji4Mua9VDOrqGgkcxiJQ7Lg= X-Received: by 2002:a05:6830:4aa:: with SMTP id l10mr21889419otd.214.1595307592350; Mon, 20 Jul 2020 21:59:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 21 Jul 2020 06:59:40 +0200 Message-ID: To: tyson andre Cc: PHP Internals List Content-Type: multipart/alternative; boundary="00000000000059809205aaec7ec0" Subject: Re: [PHP-DEV] Re: [RFC][DISCUSSION] debug_backtrace alternative as an array of StackFrame objects From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Marcin_Brzuchalski?=) --00000000000059809205aaec7ec0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Tyson, wt., 21 lip 2020 o 04:27 tyson andre napisa=C5= =82(a): > ... > I had some comments on the implementation in > https://github.com/php/php-src/pull/5820#pullrequestreview-452045885 > Most of these comments can be worked upon the next days in the meantime. > - How much does this change elapsed time in typical use cases? This had > completely skipped my mind when I saw this RFC, but I'd generally assume > that stack traces aren't kept along for longer than needed to process the= m, > and that most stack traces would be at most hundreds of frames in typical > applications. So I'd consider CPU time elapsed more important than RAM. > The current implementation works similarly as original one which instead of creating an array creates an object of StackFrame. In general use of resources depends on programming style, amount of rethrows etc. Some use exceptions inappropriately and keep the objects living for a significant time etc. > I'd had similar issues with the tradeoffs in PhpToken (and forgot). > Those issues were that the applications using the array would use less > memory and be faster if I used the returned array multiple times, but les= s > so if I only processed the array once and immediately freed it. > PHP also seems faster at fetching dimension from arrays than properties > from objects. > > Still, though, this might help with a bit with developer productivity > (e.g. IDEs being better at inferring types of $frame->getFile() in some > cases, or providing help text for the method), or in being able to check > types when passing individual frames > - I found a bug: The ArrayAccess magic methods are implemented, but not > the real methods. > This can be fixed, PR provides an initial implementation which can be improved in the next days. > - I found some memory leaks, possibly related to tracking argument arrays > in the object being stored > > - Casting getFile() to the empty string is unexpected for me > ($frame['file'] and $frame->file are null in the implementation). > - Forbidding modification/deletion on the ArrayAccess magic API (e.g. > `$frame['trace'] =3D ...`) > seems inconsistent when modification and deletion are allowed through > the real properties, > (and throwing there may affect code written to process the array > returned by Throwable->getTrace()) > This can be adjusted to meet 99% compatibility with current array frames, the only limitation I would see here would be the inability to create properties dynamically. > - The typed property default was incompatible with the typed property > declaration (`class StackFrame { string $file =3D null; /*...*/}` for > internal stack frames) > Can you give an example of an internal stack frame? Cheers, Micha=C5=82 --00000000000059809205aaec7ec0--