Re: Re: Typed properties patch

From: Date: Tue, 19 Apr 2016 08:46:09 +0000
Subject: Re: Re: Typed properties patch
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-92444@lists.php.net to get a copy of this message
On 04/18/2016 09:37 PM, Stanislav Malyshev wrote:
Hi!
right. I don't see any reasons for types, if they are not guaranteed anyway.
Well, we already have parameter types, and they are not guaranteed either - you can reassign variables. They guarantee the type of argument on function entry.
This depends on use case. Just imagine matrix multiplication (or something similar). Few additional instructions would decrease the speed significantly.
I think this is a very narrow use case. If somebody does large data processing (like large matrix multiplication) in pure PHP, they are doing it wrong anyway. More properly - PHP is done in a way that doesn't allow big data processing yet :)
LuaJIT may be used for in-kernel packet filtering...
So trying to optimize for their use case I think is not a high priority. I would say for any typical PHP app cost of one unexpected branch is negligible. One is not, but 100 matters.
Run bench.php with CALL and GOTO VM. You'll see 20-30% performance difference caused by branch miss-prediction. Now think about JIT, and "code-bloat" caused by additional type checks. I think, If we may eliminate checks we should do it (at type-system design level). Thanks. Dmitry.

« previous php.internals (#92444) next »