执行金额的命名空间会影响性能? [英] Do the amount of namespaces affect performance?

查看:113
本文介绍了执行金额的命名空间会影响性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio中有一个命令删除using语句未使用

In Visual Studio there is a command to remove unused using statements

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

有没有性能损失具有不使用usings?

Is there a performance hit for having unused usings?

推荐答案

在code文件中使用不会影响应用程序的运行时性能命名空间的数量。它确实有编译时产生影响,因为编译器必须寻找那些命名空间其他项目,如类和扩展方法。

The number of namespaces used in code files does not impact the runtime performance of the application. It does have an impact on compile time as the compiler must search those namespaces for additional items such as types and extension methods.

唯一运行的影响名称空间的数量我所知道的是

The only runtime impact the number of namespaces I'm aware of are


  • 调试:在给定的code文件中的设置使用的命名空间存储在PDB和名称解析过程中的调试器协商。有很多命名空间理论上可以影响调试程序的性能,但在实践中我还没有看到这是一个问题。

  • Asp.Net:如果使用的是哪里的页面上首先查看用户编制的部署模型,命名空间的数量会影响加载时间在第一时间给定的页面中查看

这篇关于执行金额的命名空间会影响性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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