Git Product home page Git Product logo

Comments (2)

munggruel avatar munggruel commented on June 25, 2024

性能 和 纯c比 会有多少性能损失

from pni.

zuocheng-liu avatar zuocheng-liu commented on June 25, 2024

ZEND_REGISTER_RESOURCE 是单个进程中进行的,多个进程间不会共享,保存resource资源的结构体,在每个进程中维护。(进程间共享数据的方式,只有信号、信号量,unix域、管道、共享内存,消息队列那几种)

一般情况下,操作系统为单个进程运行时加载相同动态库只需加载1次。但是PNI使用fnctl库中 dlopen,dlclose,完全可以动态加载和关闭动态链接库。PNI还做了一个优化,把打开的动态链接库句柄持久化,这样PNI打开相同的动态链接库只要加载1次即可。

并发情况下,因为php-fpm 使用Fastcgi模式,也就是多进程模型。 这样每个进程启动都会动态加载1次动态链接库,但是每个进程可以被重复使用,去多次处理不同请求,所以单个进程对动态库加载只需要1次,后面重复使用。

动态链接库和纯c相比,或者说与静态编译相比,有人做过测试,性能会损失3%左右,《程序员的自我修养》这本书上好像有提到。像PHP扩展这种,大多也都是以动态链接库的方式去加载的。

我看到您已经加QQ群啦,欢迎到群里聊啊。

from pni.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.