How to insert assembly code in php?

I want to use assembler code to solve some important performance problems with PHP. How can i do this? I searched before, but didnโ€™t understand anything.

+6
source share
2 answers

I believe that you are talking about the PHP extension.

You can do this by creating custom extensions in c. A simple tutorial on how to do this can be found here.

+4
source

Using the assembly for your performance problems is similar to using a sledgehammer to open the dam, while there is probably a lever that opens the dam. Better take a look at your structure first and see why these critical tasks have performance issues and see if you can change the structure.

In addition, since php is a scripting language that is interpreted at runtime, rewriting C code, as in the Udan example, gives a 90% increase in performance, rewriting C code to the assembly can add some additional 10%, but it will take 90% of the time .

On the other hand, the argument that you use in your assembly code gives you some bragging rights, up to the moment when another programmer looks at your code, restructures it, increasing productivity by 50% and completely bypassing your assembly.

+1
source

Source: https://habr.com/ru/post/956465/


All Articles