未使用的使用声明会降低性能吗? [英] Do unused use statements decrease performance?

查看:354
本文介绍了未使用的使用声明会降低性能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道类中未使用的use语句是否会影响我的php网站的性能?

I want to know if unused use statements in my class affect performance of my php website?

php是否在开始时或需要时包括所有类?如果是第二选择,那么我认为它不会影响我的系统性能.

Does php include all classes in beginning or when need it? If second choice then I think it doesn't affect performance of my system.

例如:未使用使用语句'DbConnector'

use model\adapter\DbConnector;

推荐答案

不,use语句不会激发要加载的类(甚至不会触发自动加载器).

No, the use statement does not provoke the the class be loaded (it does not even trigger an autoloader).

它只是声明一个类的缩写.我假设在CPU和RAM方面的成本大约是几个CPU周期和几个字节.

It just declares a short name for a class. I assume the cost in terms of CPU and RAM is in the order of a few CPU cycles and a few bytes.

这篇关于未使用的使用声明会降低性能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆