且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

与32位相比,Visual Studio Code 64位的可量化好处是什么?

更新时间:2023-02-27 13:11:46

64位Visual Studio代码的存在很大程度上是 Node.js -和基于Chromium 的运行时电子支持32位和64位体系结构,而不是该应用程序的主要设计目标。微软用Electron开发了VS Code,这是一个用于使用Web技术构建桌面应用程序的框架。

The existence of 64-bit Visual Studio Code is largely a side-effect of the fact that the Node.js- and Chromium-based runtimes of Electron support both 32- and 64-bit architectures, not a primary design goal for the application. Microsoft developed VS Code with Electron, a framework used to build desktop applications with web technologies.

因为Electron已经包含了两种体系结构(以及不同操作系统)的运行时代码可以毫不费力地提供两个版本-电子从JavaScript代码中提取了机器之间的差异。

Because Electron already includes runtimes for both architectures (and for different operating systems), VS Code can provide both versions with little additional effort—Electron abstracts the differences between machines from the JavaScript code.

相反,Microsoft将Visual Studio的大部分内容分发为包含特定于机器的指令的已编译二进制文件,而重写和维护64位源代码的成本在历史上超过了任何好处。通常,如果最终用户不超过32位系统的限制,则64位程序对最终用户的速度不会比32位程序快。 Visual Studio的IDE外壳并没有太多繁琐的工作-在典型工作流中,大部分昂贵的处理工作是由通常支持64位系统的集成工具链(编译器等)执行的。

By contrast, Microsoft distributes much of Visual Studio as compiled binaries that contain machine-specific instructions, and the cost of rewriting and maintaining the source code for 64-bits historically outweighed any benefits. In general, a 64-bit program isn't noticeably faster to the end user than its 32-bit counterpart if it never exceeds the limitations of a 32-bit system. Visual Studio's IDE shell doesn't do much heavy-lifting—the bulk of the expensive processing in a typical workflow is performed by the integrated toolchains (compilers, etc.) which usually support 64-bit systems.

考虑到这一点,我们从运行64位版本的VS Code可能会注意到的所有好处与使用64位网络浏览器所看到的类似。最重要的是,一个64位版本可以处理4 GB以上的内存,这可能与我们需要同时打开很多文件或非常大文件,或者如果我们使用很多 heavy 扩展名。因此,对我们开发人员而言最重要的是编辑器在被滥用时不会耗尽内存。

With this in mind, any benefits we may notice from running a 64-bit version of VS Code are similar to those we would see from using a 64-bit web browser. Most significantly, a 64-bit version can address more than 4 GB of memory, which may matter if we need to open a lot of files simultaneously or very large files, or if we use many heavy extensions. So—most important to us developers—the editor won't run out of memory when abused.

这听起来像是值得购买的保险单签名,即使我们从未达到这些内存限制,也请记住,与32位应用程序相比,64位应用程序通常消耗更多的内存。如果需要较小的内存占用空间,我们可能希望选择32位版本。大多数开发人员可能永远都不会碰到这4 GB的墙。

While this sounds like an insurance policy worth signing, even if we never hit those memory limits, remember that 64-bit applications generally consume more memory than their 32-bit counterparts. We may want to choose the 32-bit version if we desire a smaller memory footprint. Most developers may never hit that 4 GB wall.

在极少数情况下,如果我们使用扩展名可能需要选择32位或64位版本包装本机代码,例如为特定体系结构构建的DLL。

In rare cases, we may need to choose either a 32-bit or 64-bit version if we use an extension that wraps native code like a DLL built for a specific architecture.

使用64位版本的VSCode会给我们带来的其他正面或负面影响取决于Electron底层运行时组件的版本以及所运行的操作系统上。这些特征随着开发的进行而不断变化。因此,很难以一般的方式说明32位或64位版本的性能优于其他版本。

Any other consequences, positive or negative, that we experience from using a 64-bit version of VSCode depend on the versions of Electron's underlying runtime components and the operating system they run on. These characteristics change continuously as development progresses. For this reason, it's difficult to state in a general manner that the 32-bit or 64-bit versions outperform the other.

例如,V8 JavaScript引擎历史上禁用了今天启用的64位系统上的某些优化。某些优化仅在操作系统为其提供功能时可用。

For example, the V8 JavaScript engine historically disabled some optimizations on 64-bit systems that are enabled today. Certain optimizations are only available when the operating system provides facilities for them.

Windows上的未来64位版本可能会利用地址空间布局随机化,以提高安全性(地址空间中的更多位会增加熵)。

Future 64-bit versions on Windows may take advantage of address space layout randomization for improved security (more bits in the address space increases entropy).

对于大多数用户而言,这些细微差别确实无关紧要。选择与您的系统架构匹配的版本,并仅在遇到问题时保留切换。对编辑器的更新将继续为其基础组件带来优化。如果资源使用是一个大问题,那么您可能首先不想使用GUI编辑器。

For most users, these nuances really don't matter. Choose a version that matches the architecture of your system, and reserve switching only if you encounter problems. Updates to the editor will continue to bring optimizations for its underlying components. If resource usage is big concern, you may not want to use a GUI editor in the first place.