gpt4 book ai didi

Java 泛型 : Type Inference Performance

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:40:09 27 4
gpt4 key购买 nike

我想知道 Java 7 中泛型类型推断的性能损失是什么。“泛型方法类型推断”成本(即 this )与“泛型赋值类型推断”成本(即 this )是否不同?我想成本可以忽略不计,因为泛型的类型推断是在编译时完成的?

此外,就 Java 8 中的“改进类型推断”(即 this )而言(由于 lambda),这是否也会影响性能? Java 8 和 Java 7 中类型推断的性能成本有何不同?

我意识到这些是困难的(并且可能是信息不灵通的)问题,因此欢迎任何意见。

最佳答案

Is the "generics method type inference" cost (i.e., this) different from the "generics assignment type inference" cost (i.e., this)?

没有。

I suppose the cost is negligible since type inference on generics is done in compile time?

除非您计算编译时间,否则成本为零。

Also, as far as "improved type inference" (i.e., this) in Java 8 (due to lambda's), does this also levy a performance hit?

这也是零。没有关于它的“也会影响性能”。

关于Java 泛型 : Type Inference Performance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16684330/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com