Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

性能啊,测试完大吃一惊啊,需要改善哪 #28

Closed
yunyet opened this issue Apr 5, 2016 · 2 comments
Closed

性能啊,测试完大吃一惊啊,需要改善哪 #28

yunyet opened this issue Apr 5, 2016 · 2 comments

Comments

@yunyet
Copy link

yunyet commented Apr 5, 2016

测试 fib(30),分别用 Go(native),gopher-lua, qlang, otto

fib = fn(n) {
    if n < 2 {
        return n
    }
    return fib(n-2) + fib(n-1)
}

fib(30)

结果:

BenchmarkGolang-4           1000           1723098 ns/op               1 B/op          0 allocs/op   
BenchmarkGopherlua-4           5         230613180 ns/op          539003 B/op       1391 allocs/op   
BenchmarkQlang-4               1        12594720400 ns/op       2801072688 B/op 52523860 allocs/op   
BenchmarkOtto-4                1        14532831200 ns/op       4954536800 B/op 75394539 allocs/op   

没想到, gopher-lua 速度比 qlang快50多倍,otto 和qlang倒是一个数量级别的。
实在想不通,qlang为什么比 同样是 pure-go 实现的 gopher-lua 慢如此多?

@yunyet
Copy link
Author

yunyet commented Apr 5, 2016

补上测试代码
script_test.go.txt

@xushiwei
Copy link
Member

xushiwei commented Apr 5, 2016

当前仍然是专注在使用界面上,而不是性能上。主要是如果有性能敏感的代码,在 qlang 中很容易通过 go 来解决,所以性能没有当做最重要的事项来跟进。详细可参考 #7 这个 issue。

@xushiwei xushiwei closed this as completed Apr 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants