Github's joyful PHP code triggers complaints
The day before yesterday, a piece of code that can improve operating efficiency by 70% suddenly appeared in the PHP section of github, which triggered complaints and ridicules from many netizens around the world, "awesome!", "well done!", "PHP is the world's first language!" Programmers who are usually serious and hardworking give full play to their humorous side, and GitHub has become a sea of joy.
Let’s take a look at this piece of god-level code first:
What this code does is one thing: disable PHP’s garbage collector. Then netizens tested the effect of using the garbage collector with PHP disabled:
Before: Memory usage: 163.66MB (peak: 403.82MB), time: 246.25s
After: Memory usage: 163.34MB (peak: 350.36MB), time: 99.55s
The time required to run a certain PHP program is from 246.25 seconds Reduced to 99.55 seconds!Before: Memory usage: 152.71MB (peak: 335.9MB), time: 195.99s
After: Memory usage: 164MB (peak: 308.02MB), time: 104.06s
The time required to run a certain PHP program is reduced from 195.99 seconds To 104.06 seconds!……
In general, disabling the garbage collector can improve PHP's operating efficiency by 70%.
Since PHP’s garbage collection is so unreliable, what was the original intention of its previous design?
Because in C/C++, memory management is a very troublesome thing. The use and release of memory require programmers to write programs to operate manually. If something is omitted, it may cause a waste of resources or even a memory leak. Therefore, in order to avoid this problem during PHP design, a garbage collector was introduced to automatically release the memory of useless objects.
It is worth mentioning that PHP will consume additional time when running the recycling algorithm. Although in smaller projects, this additional consumption is minimal, when running large projects, since multiple recycling threads are started at the same time, this consumption will have a great impact. The most intuitive manifestation is the program running The time got longer.
Disabling PHP’s garbage collection is the simplest and crudest way to improve the efficiency of program operation. This is just like if a leg or foot is injured, the easiest way is to amputate it.
As soon as the god-level code was announced, the programmers on github were overjoyed:
Homm, who came first, expressed his surprise at this method of processing and did not understand why it was done, and objectively commented that this method of processing does not look good:
Then smileytechguy came and started teasing: "Well, there is no comment. Let us disable the PHP kernel. We will not explain why we do this."
Then it started to get out of control:
Those who use soy sauce:
Those who complain and ridicule:
Just to say that PHP is the world’s number one language, there are versions in several countries. It is said that just using a few pieces of code can increase efficiency by 70%. PHP is well deserved to be the world’s number one language:
There are also cute ones:
PHP’s garbage collection mechanism has become everyone’s joke. We also know that simply disabling PHP garbage collection cannot solve problems such as memory overflow. How PHP handles the contradiction between memory management and operating efficiency in the future will be a heavy task. A long way to go.
The above has introduced the Github Joyful PHP god-level code that caused complaints, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
