• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

qtiuto/lua-for-android: A high-performance bridge for lua and java or c in Andro ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

qtiuto/lua-for-android

开源软件地址(OpenSource Url):

https://github.com/qtiuto/lua-for-android

开源编程语言(OpenSource Language):

Java 75.0%

开源软件介绍(OpenSource Introduction):

Build Status Download

General

This is a friendly and high performance bridge for java and lua in android. With it, you can call java functions, use java objects easily in lua. It supports auto method deduction, auto data conversion, import java package/class, multi-thread, exception handling, class extension/implementation and other facilitative features. See wiki for more detailed description.

Module luaffi, luasec, luasocket are optional package. And module lfs is embeded.

Both lua(5.1-5.3) and luajit(2.0.5 and 2.1.0-beta3) are supported.

Configure Android.mk by setting LUA_LIB :=(lua or luajit) to choose the proper version.

Currently, lua 5.3.5 is in lua dir and luajit 2.1.0 beta-3 is in luajit dir.

Load the lib by LibLoader.java in the module app or add System.loadLibrary("luadroid.so") to your code.

Module lib is the true library that you can embedded into your code.

Module app is a lua editor for running test in android.

Module luaffi is the ffi lib for luadroid to invoke c apis, and it requires luadroid.so to be statically linked

Performance

Under release mode, the bridge around 3+ times slower than jni because of consumption in method deduction and data conversion. Yet, if no argument provided, it is almost as fast as jni.

Around 2500000 method call(Math.abs) per second on my Oneplus 5 device. Around 1800000 member access plus with method call(Math.abs) per second. Note that if you run it in debug mode,CheckJni mode is enabled by the vm,and it will take away more than half of the efficiency.

Here is the test script:

using "java.lang"
--for method call test
local abs=Math.abs
local t=os.clock()
for i=1,2.5e6 do
    abs(0)
end
print(os.clock()-t)

--for member access test
t=os.clock()
for i=1,1.8e6 do
    Math.abs(0)
end
print(os.clock()-t)

Documentation

For documentation,see wiki.

Email:

[email protected]




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap