简体   繁体   English

jar文件的大小是否会影响JVM的性能?

[英]Does the size of a jar file affect the performance of the JVM?

I was wondering if the size of jar file has any implications for the peformance of the Java Virtual Machine? 我想知道jar文件的大小是否对Java虚拟机的性能有任何影响?

Is there going to be a point where the jar file becomes too large that the JVM will not be able to function effectively? 是否会出现jar文件太大而JVM无法有效运行的程度?

Yes, the size of the jar file has implications on performance. 是的,jar文件的大小对性能有影响。 The more appropriate question is, does it have any significant implications? 更合适的问题是,它是否有任何重大影响? The answer to that question is no. 这个问题的答案是否定的。

Yes, there is a point where the jar file becomes too large and affects the JVM. 是的,有一点是jar文件变得太大并影响JVM。 I don't know where it is, but it's somewhere near the size of your system memory. 我不知道它在哪里,但它的位置接近系统内存的大小。 If the JVM cannot load the entire JAR file and the Java libraries in system memory without swapping, this will certainly affect performance. 如果JVM无法在不交换的情况下将整个JAR文件和Java库加载到系统内存中,这肯定会影响性能。

This isn't something you need to concern yourself with. 这不是你需要关心的事情。 Don't include JAR files in the classpath that aren't being used. 不要在类路径中包含未使用的JAR文件。 Don't include a bunch of code in your project JAR file that isn't being used. 不要在项目JAR文件中包含一堆未使用的代码。 I highly doubt you'd be creating an application anywhere near the size required to impact the performance of the JVM. 我非常怀疑你是否正在创建一个接近影响JVM性能所需大小的应用程序。

In my opinion the size of the jar is not the factor to look at when trying to increase performances. 在我看来,当试图提高性能时,罐子的大小不是要考虑的因素。

If you have big jars, it means you have lot of code. 如果你有大罐子,这意味着你有很多代码。 If you have lot of code because you are working on a complex project, all is ok for me. 如果您有很多代码,因为您正在处理一个复杂的项目,那么对我来说一切都很好。 If you have big jars for a "simple" project it may means that the code need to be thinking again => Well designed classes are often the way to achieve the smaller code size and thus the smaller jars. 如果你有一个“简单”项目的大罐子,它可能意味着代码需要再次思考=>设计良好的类通常是实现较小代码大小的方式,因此也就是较小的jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM