HTTP/2 Push is dead – Evert Pot

One of the hot features that came with HTTP/2 was PUSH frames. The main idea is
that if the server can predict what requests a client might want to make, the
server can preemptively send request/response pairs to the client and warm it’s
cache.

This is a feature I’ve been very interested in for a long time. I feel that it
can be incredibly useful for APIs to invalidate & warm caches, remove the need
for compound requests (which I feel is a hack, although sometimes a
necessary one).

To help advance this idea, I’ve worked on a Internet Draft to let API
clients tell the server what resources they would like to have pushed, I built
a Node.js framework with first-class, deeply integrated Push support, and
added support for Prefer-Push to Ketting.

Unfortunately HTTP/2 push always felt like feature that wasn’t quite there yet.
It’s usefulness was stunted due to Cache-Digest for HTTP/2 being killed
off, and no browser APIs to hook into push events.

The Chrome team has considered removing Push support since at least 2018. The
main reason being that they hadn’t really seen the performance benefit for
pushing static assets. At the time, I tried to defend the feature for
the API use-case.

Yesterday, the Chrome team announced to remove the feature from their HTTP/2 and HTTP/3 protocol implementations.

I’m a little sad that it never got to its full potential, but with this step,
I no longer think it’s worthwhile to invest in this feature. So I’m ceasing
my work on Prefer-Push, and will also remove support from the next major
Ketting version.

On a positive note, I spent a lot of time thinking and working on this, but
it is sometimes nice to just be able to close a chapter, rather than to wait
and let it sizzle out. It’s not an ideal conclusion, but it’s a conclusion
nonetheless.

Current alternatives

Lacking server-driver push, we’re back to many small HTTP request, or compound
requests. This means you either have the N+1 problem, or (in the case of
compound requests) poor integration with HTTP caches. More on this here.

If you’re going the ‘compound request’ route, there is a draft of a similar
header as Prefer-Push; Prefer: transclude, which Ketting also
supports.

A feature that I hoped would work well in the future with Server Push was
server-initiated cache invalidation. We never quite got that. To work around
this, we use Websockets and will keep doing this for the forseeable future.

To reduce general latency of fetching many things, the 103 Early Hints
can help, although this is not supported yet in Chrome, and this is also
only really useful for speeding up delivery of assets like images, css and
Javascript as there’s no way to hook into 1xx responses programmatically in
a browser.

PHP Internals News: Episode 70: Explicit Octal Literal – Derick Rethans

PHP Internals News: Episode 70: Explicit Octal Literal

In this episode of “PHP Internals News” I talk with George Peter Banyard (Website, Twitter, GitHub, GitLab) about an RFC that he has proposed to add an Explicit Octal Literal to PHP.

The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news

Transcript

Derick Rethans 0:15

Hi, I’m Derick, and this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language.

Derick Rethans 0:24

This is Episode 70. Today I’m talking with George Peter Banyard, about a new RFC that he’s just proposed for PHP 8.1, which is titled explicit octal literal. Hello George, would you please introduce yourself?

George Peter Banyard 0:38

Hello Derick, I’m George Peter Banyard, I’m a student at Imperial College London, and I contribute to PHP in my free time.

Derick Rethans 0:46

Excellent, and the contribution that you’re currently have up is titled: explicit octal literal. What is the problem that this is trying to solve?

George Peter Banyard 0:56

Currently in PHP, we have four types of integer literals. So decimal numbers, hexadecimal, binary, and octal. Decimal is just your normal decimal numbers; hexadecimal starts with 0x, and then hexadecimal characters so, null to nine and A to F, and then binary starts with 0b, and then it’s only zeros and ones. However, octal notation is just a decimal, something which looks like a decimal number, which was a leading zero, which doesn’t really look that much different than a decimal number, but it comes from the days from C and everything which just uses like a zero as a prefix.

Derick Rethans 1:48

But I have seen is people using like array keys for the, for the month names right and they use 01, 02, 03, you get 07, and 08 and 09, and then they look at the arrays. They notice that they actually had the zeroth element in there but no, but no eight or nine. That’s something that is that PHP no longer does I believe. No, it’s mostly that the parser doesn’t pick it up anymore. Instead of silently ignoring the eight, it’ll just give you an error. You’ve mentioned that there’s these four types of numbers with octal being the one started with zero. But what’s the problem with is that a moment?

George Peter Banyard 2:31

Sometimes when you want to use, which looks like decimal number. So, for example, you’re trying to order months, and use like the full two digits for the month number, instead of just one, you use 01, as an array key. When you get to array, it will parse error because it can’t pass 08 as an octal number, which is very confusing, because it. Most people don’t deal with octal numbers that often, and you would expect everything to be decimal. Because numeric strings are always decimal, but not integers literals. So, the proposal is to add an explicit octal notation, which would be 0o. So python does that, JavaScript has it, Rust also has it, to allow like a by more explicit to say oh I’m dealing with an octal number here. This is intended.

Derick Rethans 3:33

Beyond having the 0b for binary, and the 0x for hexadecimal, the addition of 0o for octal is the plan to add. And is that it?

George Peter Banyard 3:45

That’s more or less the proposal. It’s non-BC, because the parser before would just parse or if you had 0o, so t

Truncated by Planet PHP, read more at the original (another 12825 bytes)

PHP 8.0 feature focus: Attributes – platform.sh

Metaprogramming gets more meta in PHP 8.0. Last time, we looked at one of the three headline features of PHP 8.0: Constructor Property Promotion. Today, we’ll look at the second: Attributes.
A history of change Some PHP changes are proposed, discussed, implemented, and approved in short order. They’re uncontroversial, popular, and have a natural way to implement them.
And then there are the ones that are tried, fail, and come back multiple times before they are finally accepted.

PHP 8.0.0 Release Candidate 4 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the tenth testing release of PHP 8.0.0, Release Candidate 4. At this time, we’re not planning to adjust the GA date, however this may change during the course of the RC cycle. The updated release schedule can, as always, be found on the PHP Wiki page about the PHP 8.0. For source downloads of PHP 8.0.0 Release Candidate 4 please visit the download page.Please carefully test this version and report any issues found in the bug reporting system.Please DO NOT use this version in production, it is an early test version. For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release will be the General Availability, planned for Nov 26 2020.The signatures for the release can be found in the manifest or on the QA site.Thank you for helping us make PHP better.

Xdebug Update: October 2020 – Derick Rethans

Xdebug Update: October 2020

Another monthly update where I explain what happened with Xdebug development in this past month. These will be published on the first Tuesday after the 5th of each month.

Patreon and GitHub supporters will get it earlier, on the first of each month.

I am currently looking for more funding, especially now some companies have dropped out.

You can become a patron or support me through GitHub Sponsors. I am currently 66% towards my $1,000 per month goal.

If you are leading a team or company, then it is also possible to support Xdebug through a subscription.

In October, I worked on Xdebug for about 75 hours, with funding being around 45 hours. I worked mostly on the following things:

Xdebug 3

Xdebug had its first beta release in October, 3.0.0beta1 so that uses can test out the new speed improvements, new functionality, new ways of configuring things, as well as support for PHP 8.

Some bugs were found, and I’m continuing to work together with JetBrains to make sure all the new configuration methods are also supported with/through PhpStorm.

There are also several anecdotal reports that Xdebug 3 is indeed a lot faster in many environments. I have asked the community for benchmarks, but I have not seen any write ups beyond a tweet, and an article.

PHP Internals News: Episode 69: Short Functions – Derick Rethans

PHP Internals News: Episode 69: Short Functions

In this episode of “PHP Internals News” I talk with Larry Garfield (Twitter, Website, GitHub) about a new RFC that’s he proposing related to Short Functions.

The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode’s MP3 file, and it’s available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news

Transcript

Derick Rethans 0:15

Hi, I’m Derick, and this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language.

Derick Rethans 0:24

Hello, this is Episode 69. Today I’m talking with Larry Garfield, about an RFC that he’s just announced called short functions. Hello Larry, would you please introduce yourself?

Larry Garfield 0:35

Hello World, I’m Larry Garfield, the director of developer experience at platform.sh. These days, you may know me in the PHP world mainly from my work with PHP FIG. The recent book on functional programming in PHP. And I’ve gotten more involved in internals in the last several months which is why we’re here.

Derick Rethans 0:57

I’m pretty sure we’ll get back to functional programming in a moment, and your book that you’ve written about it. But first let’s talk about short functions, what are short functions, what is the problem that are trying to solve?

Larry Garfield 1:11

Well that starts with the book actually. Oh. Earlier this year, I published a book called Thinking functionally in PHP, on functional programming in PHP, during which I do write a lot of functional code, you know, that kind of goes with the territory. And one of the things I found was that the syntax for short functions, or arrow function, or can be short lambdas, or arrow functions, you know whatever name you want to give them, was really nice for functions where the whole function is just one expression. Which when you’re doing functional code is really really common. And it was kind of annoying to have to write the long version with curly braces in PSR 2, PSR 12 format for functions that I wanted to have a name, but we’re really just one line anyway does return, blah blah blah. It worked, got the job done.

Larry Garfield 2:13

Then hanging around with internals people, friend of the pod Nikita Popov mentioned that it should be really easy. Now that we’ve got short functions, or short lambdas, do the same thing for named functions. And I thought about. Yeah, that should be doable just in the lexer, which means, even I might be able to pull it off given my paltry miniscule knowledge of PHP internals. So, I took a stab at it and it turned out to be pretty easy. Short functions are just a more compact syntax for writing functions or methods, where the whole thing is just returning an expression.

Derick Rethans 2:56

Just a single expression?

Larry Garfield 2:58

Yes. If your function is returning two parameters multiplied together, it’s a trivial case but you often have functions or methods that are doing. Just one expression and then returning the value. It’s a shorter way of writing that. Mirrored on the syntax that short lambdas use. It doesn’t enable you to really do anything new, it just lets you write things in a more compact fashion. But the advantage I see is not just less typing. It lets you think about functions in a more expression type way, that this function is simply a map from input to this expression, which is a mindset shift. So yes it’s less typing but it’s also I can think about my problem as simply an expression translatio

Truncated by Planet PHP, read more at the original (another 16063 bytes)

PHP 8.0 feature focus: Constructor Property Promotion – platform.sh

The last post talked about how PHP 8.0 makes PHP faster. Today, we’ll look at a way that it will make you faster.
Perhaps the largest quality-of-life improvement to PHP 8.0 is Constructor Property Promotion. The syntax has been borrowed largely from Hack, Facebook’s PHP fork, although it exists in other languages like TypeScript and Kotlin with various syntaxes.
It’s easiest to explain with an example. Consider your typical service class in a modern application:

PHP 8.0 feature focus: Just-in-Time compilation – platform.sh

Last time, we looked at ways in which PHP 8.0 has become stricter. Today, we look at the next step in PHP becoming faster.
Some background Computers don’t actually understand programming languages; they understand very low level instructions no human could write by hand. There are many ways of getting from a human-readable language like PHP or Rust to a computer-understandable set of instructions.
The most basic, and usually most performant, way is to compile the human-friendly source code directly to CPU instructions “Ahead-of-Time” (AOT).

PHP 8.0.0 Release Candidate 3 available for testing – PHP: Hypertext Preprocessor

The PHP team is pleased to announce the tenth testing release of PHP 8.0.0, Release Candidate 3. At this time, we’re not planning to adjust the GA date, however this may change during the course of the RC cycle. The updated release schedule can, as always, be found on the PHP Wiki page about the PHP 8.0. For source downloads of PHP 8.0.0 Release Candidate 3 please visit the download page.Please carefully test this version and report any issues found in the bug reporting system.Please DO NOT use this version in production, it is an early test version. For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release will be the Release Candidate 4, planned for Nov 12 2020.The signatures for the release can be found in the manifest or on the QA site.Thank you for helping us make PHP better.