官术网_书友最值得收藏!

Java - the 20-year-old code base

Talk about a monolith! Java has come a long way since its first release in 1996. The first major release of the JDK had a little over 500 public classes. A far cry indeed from JDK 8 released in 2014, which counts upwards of 4,200 public classes and over 20,000 total files.

The following commands extract the rt.jar file, a library JAR file bundled in JDK 8, and count the number of classes in it. With the Java 8 version I have installed on my machine, the count is 20651:

The JDK and the runtime, the JRE, have continued to grow over the years. There are a lot of features that have been added to the language, so this growth is understandable. However, the Java language is also notorious for going to great lengths to maintain backward compatibility and for its reluctance to deprecate features unless it is absolutely necessary. So, in a way, the current size of the runtime is a little over what it could have ideally been.

Normally, most application developers wouldn't need to worry about the JDK code base. They just focus on their application code. However, the contents of the runtime does matter for application execution because of the way it is bundled. Traditionally, every JRE has had all the classes necessary for runtime bundled into a single JAR that resides in the lib directory called rt.jar. The name rt, as you might have guessed, stands for runtime.

Not only is this huge monolith of classes unnecessarily bulky in size, it also adds performance overheads for the Java Virtual Machine to manage. And that's a price the execution environment of all your applications have to pay, irrespective of whether all of those classes are being used or not.

主站蜘蛛池模板: 三明市| 曲松县| 莱阳市| 壤塘县| 平江县| 平顶山市| 安庆市| 安达市| 开鲁县| 潼关县| 金阳县| 修水县| 乌兰浩特市| 绥芬河市| 吉林市| 海南省| 通州区| 石台县| 什邡市| 赤城县| 虎林市| 永嘉县| 邵东县| 聂拉木县| 综艺| 和顺县| 绥棱县| 和龙市| 绩溪县| 抚宁县| 东阿县| 隆回县| 铁岭市| 天峻县| 略阳县| 新蔡县| 神池县| 甘谷县| 灵山县| 岳阳县| 垣曲县|