BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / www-technology / #9827同步于 2010/4/11
WWWTechnology机器人发帖

[合集] Lift框架?据说比RoR快4倍。。。

xw2423
2010/4/11镜像同步0 回复
☆─────────────────────────────────────☆ wks (cloverprince) 于 (Tue Apr 7 20:16:12 2009) 提到: 最近著名的Twitter网(迷你博客)决定放弃Ruby on Rails,改用Scala语言。 该从哪里开始吐糟呢,现在web技术真是变化太快了。。。 我不确定Twitter用的是Lift。 Scala是个鲜为人知的面向对象+函数式语言,运行于Java虚拟机上。Lift是一个Web框架,基于Scala语言。据说比RubyOnRails快4倍,而多用户并发访问时,Scala比Ruby快20倍以上。 但是现在Lift的网站似乎down掉了。liftweb.net。不知是什么原因。暂时无法获取更多的消息。 下面是一个转载自lambda-the-ultimate.org的文章: 地址:http://lambda-the-ultimate.org/node/2147 A Real-World Use of Lift, a Scala Web Application Framework A Real-World Use of Lift Well, lift is actually being used in production. I converted a Rails app to lift and it was a very interesting experience... Then we did some benchmarking. For single request processing, the lift code, running inside Tomcat, ran 4 times faster than the Rails code running inside Mongrel. However, the CPU utilization was less than 5% in the lift version, where it was 100% of 1 CPU (on a dual core machine) for the Rails version. For multiple simultaneous requests being made from multiple machines, we're seeing better than 20x performance of the lift code versus the Rails code with 5 Mongrel instances. Once again, the lift code is not using very much CPU and the Rails code is pegging both CPUs. In terms of new features, we've been able to add new features to the lift code with fewer defects than with the Rails code. Our Rails code had 70% code coverage. We discovered that anything shy of 95% code coverage with Rails means that type-os turn into runtime failures. We do not have any code coverage metrics for the lift code, but we have seen only 1 defect that's been checked in in the 2 weeks since we started using lift (vs. an average of 1 defect per checkin with the Rails code.) So, yes, I'm pimping my own framework, and yes, I'm able to do with lift what guys like DHH are able to do with Rails, so the comparison is, in some ways, unfair. On the other hand, Scala and lift code can be as brief and expressive as Ruby code. lift offers developers amazing productivity gains vs. traditional Java web frameworks, just as Rails does. On the other hand, lift code scales much better than Rails code. lift code is type-safe and the compiler becomes your friend (this does not mean you should not write tests, but it means that your tests can focus on the algorithm rather than making sure there are no type-os in variable and method names.) I promise that "Dave Pollak" is not a pseudonym for "Paul Snively." Update: I guess the self-deprecating humor hasn't worked, some 400+ reads later. Although the caveat that Dave offers about trying to objectively compare his own framework with Ruby on Rails is well-taken, I think that this nevertheless is an important marker in applying a very PLT-driven language and framework, Scala and lift, to a very realistic application, especially given that it's a rewrite from a currently-popular language and framework, Ruby and Rails. We admitted proponents of static typing and weird languages are constantly being asked for this sort of thing, and while it's doubtful that this adds anything to the PLT discussion per se—at least until we have a chance to dig into lift and see how Scala's design uniquely supports it—I thought people might find the Scala connection worth commenting on. By Paul Snively at 2007-03-22 16:06 | Object-Functional | Scala | Software Engineering | XML | other blogs | 24815 reads ☆─────────────────────────────────────☆ BookMoth (书中蠹鱼) 于 (Wed Apr 8 09:05:01 2009) 提到: 我想知道为啥函数式语言开始流行了? ☆─────────────────────────────────────☆ reeze (Reeze) 于 (Wed Apr 8 14:51:58 2009) 提到: 没有Down啊。。可以访问。代码托管在Github。 ☆─────────────────────────────────────☆ coolfantasy (Cool) 于 (Wed Apr 8 14:55:50 2009) 提到: 不会比 Java 更流行 【 在 BookMoth (书中蠹鱼) 的大作中提到: 】 : 我想知道为啥函数式语言开始流行了? ☆─────────────────────────────────────☆ dragon2000 (龙之梦工作室) 于 (Wed Apr 8 22:08:59 2009) 提到: MIMD架构兴起的时候,例如多核超线程CPU体系成为主流的时候,函数式编程就会流行了。 【 在 BookMoth 的大作中提到: 】 : 我想知道为啥函数式语言开始流行了? ☆─────────────────────────────────────☆ dragon2000 (龙之梦工作室) 于 (Wed Apr 8 22:09:49 2009) 提到: Java也会过时的。 【 在 coolfantasy 的大作中提到: 】 : 不会比 Java 更流行 ☆─────────────────────────────────────☆ BookMoth (书中蠹鱼) 于 (Thu Apr 9 08:55:45 2009) 提到: 说说为啥。 【 在 dragon2000 的大作中提到: 】 : MIMD架构兴起的时候,例如多核超线程CPU体系成为主流的时候,函数式编程就会流行了。 ☆─────────────────────────────────────☆ dragon2000 (龙之梦工作室) 于 (Fri Apr 10 01:32:29 2009) 提到: 纯函数式编程是并发安全的,不象Java、C或者任何过程式语言。过程式编程基于图灵机,保存状态;函数式编程基于递归函数,没有什么状态要保存。 在并发计算中,多个任务如果要保存各自的状态,那么相互之间的计算先后次序、数据共享都会对状态造成影响,所以过程式编程有同步问题,有复杂的锁、PV操作。 而如果是多个递归函数任务,没有状态,初始的函数调用参数就决定了最终结果,那么任务之间的先后次序是无关紧要的(是指计算的正确性,不是指性能)。 也就是说,函数式编程根本不用考虑PV操作之类的并发安全问题,也不会出错。计算机是单核也好,扩展到1000个核也好,同样的程序照跑不误。过程式编程就难说了,因为不可能所有复杂环境下的测试都覆盖,而并发程序的开发本身就复杂,很有可能4核下面跑得好好的,移到8核下面就出错了。 不过涉及I/O的时候,函数式编程要保持并发安全的纯正性也不容易。这是另一个问题了。 另外,现代计算机是按图灵机模型做的,不是针对递归函数优化的,所以函数式编程的性能优势不会体现出来。函数式编程的优势是并发计算的扩展性,所以等到计算机(集群)普遍有几十个核以上再来看吧。 ☆─────────────────────────────────────☆ BookMoth (书中蠹鱼) 于 (Fri Apr 10 09:01:13 2009) 提到: 厄……还是有些迷糊。 有什么推荐看的东西么? 【 在 dragon2000 的大作中提到: 】 : 纯函数式编程是并发安全的,不象Java、C或者任何过程式语言。过程式编程基于图灵机,保存状态;函数式编程基于递归函数,没有什么状态要保存。 : 在并发计算中,多个任务如果要保存各自的状态,那么相互之间的计算先后次序、数据共享都会对状态造成影响,所以过程式编程有同步问题,有复杂的锁、PV操作。 : 而如果是多个递归函数任务,没有状态,初始的函数调用参数就决定了最终结果,那么任务之间的先后次序是无关紧要的(是指计算的正确性,不是指性能)。 : ................... ☆─────────────────────────────────────☆ dragon2000 (龙之梦工作室) 于 (Sat Apr 11 01:28:17 2009) 提到: 转载:函数式的编程序 链接: http://ericwang.blog.ccidnet.com/blog-htm-do-showone-itemid-111075.html 或 http://www.28x28.com/index.php?id=tech_000000060 ☆─────────────────────────────────────☆ liaksc (有个人) 于 (Mon Apr 13 11:20:36 2009) 提到: 原来是这样。 【 在 dragon2000 的大作中提到: 】 : 纯函数式编程是并发安全的,不象Java、C或者任何过程式语言。过程式编程基于图灵机,保存状态;函数式编程基于递归函数,没有什么状态要保存。 : 在并发计算中,多个任务如果要保存各自的状态,那么相互之间的计算先后次序、数据共享都会对状态造成影响,所以过程式编程有同步问题,有复杂的锁、PV操作。 : 而如果是多个递归函数任务,没有状态,初始的函数调用参数就决定了最终结果,那么任务之间的先后次序是无关紧要的(是指计算的正确性,不是指性能)。 : ...................
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。