Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98517 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53030 invoked from network); 14 Mar 2017 10:30:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2017 10:30:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=dz@heroku.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dz@heroku.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heroku.com designates 74.125.82.45 as permitted sender) X-PHP-List-Original-Sender: dz@heroku.com X-Host-Fingerprint: 74.125.82.45 mail-wm0-f45.google.com Received: from [74.125.82.45] ([74.125.82.45:36311] helo=mail-wm0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/F3-38004-E26C7C85 for ; Tue, 14 Mar 2017 05:30:08 -0500 Received: by mail-wm0-f45.google.com with SMTP id n11so60180331wma.1 for ; Tue, 14 Mar 2017 03:30:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heroku.com; s=google; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=Hd1UGZnGOCPHQvv7QonRurnvh4D7nkTKFMgvmc8qxw4=; b=ruPSmp3yxqMKwUitVbK34QX1AuqXkJ1THfXA8EF8fHa2hI4TeV3YAjakM9subAmUGH jgVGBVLRPGAyllA/0gtMXWrrs+mvsufz80S3ZrcolB70+W97XfScDpVWc4B/E0beSc3h 2KfgD6gJb2f2IaZtIEAPkEzM4EptMQxghFDh4QCkxKbVYE/VUbPqKRX5tZpKBZIlGlu+ /HRCCDCpJQXg3ceyq3UricJ4ZOZnyAJ4qOSmRmRVdKdOgAKpKiXAXzmYcHXYPjuZ5tP1 2qxYsO2Ycgz0MUTGGa0YaIj31I/k4e8yH/rz0UHYbRaBYLqtWW9iIlPZjwRiI4vdyKl5 lO7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=Hd1UGZnGOCPHQvv7QonRurnvh4D7nkTKFMgvmc8qxw4=; b=l8ZXEALdUDAivZFvDTg+5lT+foLIr7ibX5nr/Y22clg0bb9GybtYL+gFWpHpNXQjGH cUdMV3Gi+npftGj6yn8nS3ojxZpP2CkIGFKH6SbWkJpjeuFRvGjrtA6aWWyxyJc9aWUF uLxKWTEfJTAbA+NlhDUyzLr5+W8jIkkQkyO90v4Ohp3UF720LORWp8dQ1qonkLMsCuXI v7UMPDbxp5hfpoe4tma5P2oqkzKOZjcCztumkodj4j5DFlciGJRMsG7ROMswjhU2BXup oWP3wvt/xdFZCvuC3XSi0fcsAhYLLxiB5wMxS85heHZTATXv4+g9sR25JYQuheB901EP jCUw== X-Gm-Message-State: AFeK/H0Wpzqi1CQ9Q3Q0Ymj3rtKowUYWAEGeqeRAF7VdjFqVJbJgX4hp3WKtriDOLf8dUcMd X-Received: by 10.28.199.132 with SMTP id x126mr12818757wmf.37.1489487402516; Tue, 14 Mar 2017 03:30:02 -0700 (PDT) Received: from [172.20.10.3] (ip-109-43-0-106.web.vodafone.de. [109.43.0.106]) by smtp.gmail.com with ESMTPSA id b82sm14842708wmh.4.2017.03.14.03.30.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 03:30:01 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Message-ID: <5BF394D3-919E-4140-AFF9-F46223AB49C4@heroku.com> Date: Tue, 14 Mar 2017 11:29:59 +0100 To: PHP internals list X-Mailer: Apple Mail (2.3259) Subject: OPcache compilation performance regression in PHP 5.6/7 with huge classes From: dz@heroku.com (David Zuelke) Hi all, There appears to be a performance regression in the CFG and DFA based = optimization passes of OPcache in PHP 5.6+ when loading huge classes = (such as those generated by Symfony's routing component) for the first = time. The issue does not occur on PHP 5.5. Tests below are with 5.6.30, 7.0.16 = and 7.1.2 and default INI settings; I replicated the issue on both macOS = and Linux. Test file here (it's from an actual application, slightly anonymized, = not a synthetic example): = https://gist.github.com/dzuelke/fe867f55f09e0bf79ecefcc815b7fe92 Without OPcache, everything is fine in all versions: $ time -p php -dopcache.enable_cli=3D0 hugeclass.php=20 real 0.10 user 0.09 sys 0.00 With OPcache on, things are suddenly much, much slower: 5.6: $ time -p php -dopcache.enable_cli=3D1 hugeclass.php real 3.23 user 3.21 sys 0.02 7.0: $ time -p php -dopcache.enable_cli=3D1 hugeclass.php real 1.76 user 1.73 sys 0.02 7.1: $ time -p php -dopcache.enable_cli=3D1 hugeclass.php real 4.01 user 3.98 sys 0.02 For comparison, 5.5 is as speedy as you'd expect it to be: $ time -p php -dopcache.enable_cli=3D1 hugeclass.php=20 real 0.14 user 0.11 sys 0.02 If we switch off optimization passes 5 (CFG based) and 6 (DFA based, = only in 7.1), everything is great again in all versions: $ time -p php -dopcache.enable_cli=3D1 = -dopcache.optimization_level=3D0x7FFFFFCF hugeclass.php real 0.13 user 0.10 sys 0.02 For 5.6 and 7.0, pass 6 is not a thing, but in 7.1, we can inspect = passes 5 and 6 separately. Pass 5 (CFG based) already makes for a drastic performance hit in 7.1: $ time -p php -dopcache.enable_cli=3D1 = -dopcache.optimization_level=3D0x7FFFFFDF hugeclass.php real 0.88 user 0.86 sys 0.01 But pass 6 (DFA based) is the one that causes the biggest slowdown in = 7.1: $ time -p php -dopcache.enable_cli=3D1 = -dopcache.optimization_level=3D0x7FFFFFEF hugeclass.php real 3.29 user 3.24 sys 0.04 In all versions, subsequent loads from the cache (such as when running = FPM or the built-in web server) are fast. Is this slowness with a cold cache expected/accepted, or does that = qualify as a bug? David