通过查看内置类的编译器代码来编写优化代码的示例 [英] Example to write optimised code by seeing compiler code of built-in classes

查看:159
本文介绍了通过查看内置类的编译器代码来编写优化代码的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能不是一个实际的问题,但我只是要求它为了获得一些有价值的附加知识。我遇到过很多次(如阅读许多文章和博客),一旦一个人成为一个特定编程语言的专家,他们倾向于通过查看最小细节的实现来优化他们构建的任何应用程序的代码通过查看它们用于开发应用程序的每个内置类的编译器代码。但我没有看到这种情况的例子。任何人都可以建议任何或给一个片段。我相当擅长Java,所以如果任何这样的优化示例存在于Java可以任何人请写一个代码片段。
如果不是我不介意任何进度。语言作为一个问题,几乎包括目前使用的。

This may not be a actual question, but I just asked it for the sake of gaining some valuable added knowledge. I have come across this many times(as in reading many articles and blogs) that once a person becomes an expert in a particular programming language, they have the tendency to optimize their code in whatever application they built by seeing how the minutest details are implemented by seeing the compiler code of each built in class they use for developing the application. But I have seen no example of such a situation. Can anyone please suggest any or give a snippet. I am quite good at Java so if any such optimization example exists in Java could anyone please write a code snippet. If not I don't mind for any prog. language as the question encompasses almost the presently used ones.

推荐答案


一个特定的编程语言,他们倾向于通过查看它们用于开发应用程序的每个内置类的编译器代码,通过查看最小细节的实现来优化他们的代码。

once a person becomes an expert in a particular programming language, they have the tendency to optimize their code in whatever application they built by seeing how the minutest details are implemented by seeing the compiler code of each built in class they use for developing the application

其实我会说相反,而是你更有可能看到

Actually I would say the opposite, instead you are more likely to see



  • 中级:尝试优化一切只是因为你可以。

  • 专家:维护是最重要的。简单,干净的代码通常表现最好,当你可以确定代码需要优化,只有这样做。例如


任何人都可以建议任何人或提供一个代码段

Can anyone please suggest any or give a snippet

我建议您阅读 java.lang。* java.util。* java.util.concurent。* 这些是广泛使用和专门针对Java优化的。如果你假设复杂或钝的代码更专家,你可能会失望。 ;)

I suggest you read the code in the java.lang.*, java.util.* and java.util.concurent.* These are widely used and expertly optimised for Java. If you are assuming that complicated or obtuse code is more "expert" you are likely to be disappointed. ;)

这篇关于通过查看内置类的编译器代码来编写优化代码的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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