有关各种嵌入式脚本

最近一直在慢慢了解各种脚本语言嵌入C++、相互调用的方式以及性能。一共涉及Python, Lua, Luaplus, LuaBind, Mono C#等几种方式。

总结如下:

1.先上脚本性能 C# vs Lua

 C# Mono used what fraction? used how many times more? 
Benchmark Time Memory Code
 fannkuch-redux 1/31 17× ±
 n-body 1/21 17× ±
 mandelbrot 1/16 46×
 spectral-norm 1/8 15×
 reverse-complement 1/8 1/4
 fasta 1/7 13× ±
 binary-trees 1/5 1/4 ±
 k-nucleotide 1/2 ±
 pidigits 10×
 regex-dna ±
 C# Mono used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs) 1/31 1/31 1/16 1/7 1/2 ±

python3 vs lua

 Python 3 used what fraction? used how many times more? 
Benchmark Time Memory Code
 reverse-complement 1/3 ± 1/2
 regex-dna 1/2 1/2 ±
 binary-trees ± ± ±
 fannkuch-redux ± ±
 pidigits ± 1/2
 k-nucleotide 1/2 ±
 n-body ±
 mandelbrot 70×
 spectral-norm ±
 fasta ±
 Python 3 used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs) 1/3 1/3 ±

脚本功能:注册全局函数到脚本,注册类成员到脚本,注册类方法到脚本,脚本生成c++类,调用脚本函数,脚本函数以c++类为参数(注册类对象到脚本),Unicode支持,继承支持

1.luaPlus: 不支持继承。支持其他。但是对于调用脚本函数并且有c++对象作为参数还比较麻烦。需要进行绑定metatable和解绑的过程

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值