使用 Scala 的结构类型有哪些性能和维护方面的考虑? [英] What are the performance and maintenance considerations of using Scala's structural types?

查看:42
本文介绍了使用 Scala 的结构类型有哪些性能和维护方面的考虑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的同事不允许我在这两个方面使用它们.:(

My co-workers wont let me use them on both grounds. :(

推荐答案

一个性能考虑是结构类型中的方法通过反射调用,这在 JVM 上比常规方法调用慢很多.有关详细信息,请参阅此答案和评论.

A performance consideration is that the methods in a structural type are called via reflection, which is a lot slower on the JVM than a regular method call. See this answer and comments for detailed info.

这篇关于使用 Scala 的结构类型有哪些性能和维护方面的考虑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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