Node.js 用于 lua?
过去几天我一直在玩node.js(nodejs),它太棒了。据我所知,lua 没有类似的 libev 和 libio 集成,这让我们可以避免几乎任何阻塞调用并以异步方式与网络和文件系统交互。
我正在慢慢地将我的java实现移植到nodejs,但令我震惊的是luajit比v8 JavaScript快得多并且使用的内存少得多!
我想象在这样的环境中编写我的服务器(非常快速且响应迅速,内存使用量非常低,非常具有表现力)将极大地改善我的项目。
作为lua新手,我只是不确定这样的事情是否存在。我将不胜感激任何指点。
谢谢
I've been playing around with node.js (nodejs) for the past few day and it is fantastic. As far as I can tell, lua doesn't have a similar integration of libev and libio which let's one avoid almost any blocking calls and interact with the network and the filesystem in an asynchronous manner.
I'm slowly porting my java implementation to nodejs, but I'm shocked that luajit is much faster than v8 JavaScript AND uses far less memory!
I imagine writing my server in such an environment (very fast and responsive, very low memory usage, very expressive) will improve my project immensly.
Being new to lua, I'm just not sure if such a thing exists. I'll appreciate any pointers.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
最近对应的一个项目是 Luvit "(Lua + libUV + jIT = pure Awesomesauce )”。
来自 公告:
A recent corresponding project is Luvit "(Lua + libUV + jIT = pure awesomesauce)".
From the announcement:
看起来以下正是我正在寻找的内容:
LuaNode https://github.com/ignacio/LuaNode
Looks like the following is exactly what I was looking for:
LuaNode https://github.com/ignacio/LuaNode
请参阅 lualibevent 和 lua-ev 以及 Lua Gem #27
See lualibevent and lua-ev and also Lua Gem #27
您还可以查看 luv:
https://github.com/richardhundt/luv
来自 lua 邮件列表的
You might also have a look at luv:
https://github.com/richardhundt/luv
from the lua mailing list:
您可能想看看 Luvit 或浏览 Lua Github 站点。我认为它采用了在 Lua 内部实现 Node.js 功能的方法。您可以在客户端和服务器端编写 Lua 代码。以下是 Luvit 在 Lua 中执行 Node.js 功能的方法的描述。
You might want to take a look at Luvit or a gander at the Lua Github site. I think it takes the approach of implementing Node.js functionality right inside Lua. You write Lua code on the client side and on the server side. Here is a description of Luvit approach to doing Node.js functionality in Lua.
如果我理解问题正确,请查看 http://openresty.com/
if i understood the question right, take a look at http://openresty.com/
luvit 的目标就是 Lua 之于 Node.js 之于 Javascript。绝对是一个有前途的项目。
luvit aims to be to Lua exactly what Node.js is to Javascript. Definitely a promising project.
你可以通过lua-handlers获得node.js风格的非阻塞IO。
它甚至有一个异步。 HTTP 客户端,这使得启动并行 HTTP 请求变得非常容易。请参阅 test_http_client.lua 文件作为 HTTP 客户端接口的示例。
You can get node.js style non-blocking IO with lua-handlers.
It even has an async. HTTP Client, which makes it really easy to start parallel HTTP requests. See the test_http_client.lua file as a example of the HTTP client interface.
您还应该检查一下青金石。它是 OpenResty 的一个非常轻量且快速的框架: http://leafo.net/lapis/
我真的很享受它并预测它会有一个光明的未来!
正如您对利用 OpenResty 构建的任何东西所期望的那样,它的基准测试非常好:https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=query
Lapis 的作者还为 Lua 编写了一种类似 CoffeeScript 的语言,称为 MoonScript这非常好:
http://moonscript.org/
You should also check out Lapis. It's a very lightweight and fast framework for OpenResty: http://leafo.net/lapis/
I've really been enjoying it and predict it will have a bright future!
As you would expect with anything built to leverage OpenResty, it's benchmarks are insanely good: https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=query
The author of Lapis also wrote a CoffeeScript-like language for Lua called MoonScript which is quite nice:
http://moonscript.org/