Rails 元编程和性能
Rails 约定迫使框架和 gem 编写者广泛使用反射/元编程。我一直认为元编程效率较低,并且随着使用越来越多 gem 的趋势,问题是 - 对性能的影响是什么?
Rails conventions force framework and gem writers to make extensive use of reflection/meta programming. I've always assumed meta programming to be less efficient, and with the trend of using an ever growing number of gems, the question is - whats the PERFORMANCE impact?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
程序员生产力>>软件性能(通常)
真的,不用担心这个......在实践中正确的算法,正确的架构,正确的数据库模型等等比纯粹的语言性能重要得多......
X的努力没有花在对抗语言上( java xml hell,c 编译)致力于设计更好的算法和用户体验,从而产生更好、更用户友好的应用程序
Programmer productivity >> Software Performance (usually)
Really, don't worry about this... in practice correct algorithms, correct architecture, correct database model and so on are much more important than pure language performance...
X effort not spent on fighting the language (java xml hell, c compilation) is effort spent on designing better algorithms, UX which results in better and more user friendlier application
真正取决于什么样的元编程。有些是在运行时不影响性能的。只是起步有点慢。
对您的案例进行基准测试,看看会产生什么样的影响。
Really depend what kind of metaprogramming. Some are no impact performance during the runtime. Just a little slow in starting.
Do benchmark on your case and see what kind of impact there are.