当用于字段和方法接入时反射要远慢于直接代码。
Reflection is much slower than direct code when used for field and method access.
反射代码比相应的直接代码更复杂,正如性能比较的代码实例中看到的一样。
Reflection code is also more complex than the corresponding direct code, as can be seen in the code samples from the performance comparisons.
在第2部分,我展示了无论是对于字段访问还是方法调用,反射都比直接代码慢很多倍。
Back in Part 2, I showed how reflection is many times slower than direct code for both field access and method calls.
So the interpreter is simply operating directly on your code at run time.
因此解释器在运行程序的时候,会直接的对你的代码进行操作。
I guess it's not macho enough, John, to just, you know, you know, go off and do things by hand, you ought to just run them, but it's a valuable tool to get into, so let me do that here.
我认为这不太男人了,John,你知道的,他们仅仅是认为比起用手做来,更应该直接去运行程序,但是这确实是调试代码的非常有价值的工具,让我在这里给大家演示下吧。
OK, so how can I code this up? Well, you might think, let's just jump in and write some code, I don't want to quite do that though, because I want to show you another tool that's valuable for thinking about how to structure the code, and that is a something called a flow chart. Now.
好,那么我怎么把这个以代码实现呢,你可能会想,让我们进去直接写代码把,但是我不想这么做,因为我想教给大家另外一项很有价值的,用来组织代码的工具,叫做流程图,现在,像Guttag教授,和我这么大岁数的人。
应用推荐