[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Move to LuaJIT

Move to LuaJIT

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Somepotato   (2 posts)  [Biography] bio
Date Fri 04 Jul 2014 09:03 PM (UTC)
Message
LuaJIT can be used as a drop-in replacement to Lua, is much faster and has useful libraries(see: ffi, bit) built in.
Apparently someone has already attempted porting to LuaJIT, but I'm not sure where.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Fri 04 Jul 2014 10:34 PM (UTC)

Amended on Fri 04 Jul 2014 10:40 PM (UTC) by Fiendish

Message
Somepotato said:
LuaJIT can be used as a drop-in replacement to Lua, is much faster and has useful libraries(see: ffi, bit) built in.

So, technically I agree with you. I distribute LuaJIT in the Aardwolf MUSHclient Package (links in signature). Interestingly, the neatest thing I get out of it is not the increased performance but the ability to bust out of the API sandbox via direct Win32 calls through FFI. It lets me do things like create directories and copy files without having cmd.exe flash across the screen. But Nick isn't really wrong to not want to manage this on his end.

Transporting Nick's comments over from GitHub...

Nick Gammon said:
I think Aardwolf are already doing so. Can't you just drop in the DLL if you want to use it?


This is correct. You just need to change the name of the LuaJIT DLL to the form that MUSHclient expects, or make a proxy DLL as described here:
http://www.freelists.org/post/luajit/The-dreaded-newbie-questions,10

Nick Gammon said:
I believe there were some issues from time to time in the past, where things didn't work perfectly.


Correct. Not often, but occasionally. And this is the part that makes it hard to officially support. LuaJIT development happens rapidly. Since the last "release" (2.0.3) in March, there have been 30 bug fixes committed to the LuaJIT Git repository ( http://repo.or.cz/w/luajit-2.0.git ), including one 7 hours ago as of writing this.

I use it and distribute it to others. But it's a moving target.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Somepotato   (2 posts)  [Biography] bio
Date Reply #2 on Sun 06 Jul 2014 08:38 PM (UTC)
Message
You should just use the latest official release. LuaJIT doesn't make official releases that often so it wouldn't be exactly unreasonable to use it; it's not a requirement that you update each time there's an update to LuaJIT. While a proxy DLL would seem reasonable, it's kinda out of the way as opposed to it having official support.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Sun 06 Jul 2014 10:06 PM (UTC)

Amended on Sun 06 Jul 2014 11:40 PM (UTC) by Fiendish

Message
Quote:
You should just use the latest official release.

I disagree. 10 months passed between 2.0.2 and 2.0.3. Many of the commits in between were bug fixes. Some of them were actually hit by myself or my users. The same is happening between 2.0.3 and 2.0.4. If you're going to support LuaJIT, you should release a new DLL at least every month or two to stay on top of all of Mike's bug fixes until he stops making changes to the 2.0 branch.
In contrast, stock Lua is at least stable.
It's also not slow.

Again, I really like LuaJIT. That's why I package it and distribute it for Aardwolf. And if you can convince Nick that the benefits outweigh the costs, then I think it could be a win for plugin writers (I'd get to stop compiling it myself, for one thing). But I think you need to make a more compelling argument if you want Nick to support it.

Quote:
While a proxy DLL would seem reasonable, it's kinda out of the way as opposed to it having official support.

A proxy DLL is required regardless of whether you use LuaJIT if you want to support loading any other DLLs that point at the other name. Official support for LuaJIT doesn't change that. ( http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=12419 ) What you'd want then is also an official proxy dll.

Nothing stops you from distributing a LuaJIT DLL with any plugins that use FFI if you want to start accepting responsibility for subtle compatibility breaks like rounds going in different directions on 64 bit and 32 bit platforms. ( http://www.freelists.org/post/luajit/stringformat-i-with-float-input-does-bankers-rounding,1 )

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Mon 07 Jul 2014 05:02 AM (UTC)
Message
See this post for an example of my drawing a 3D image using standard Lua:

http://www.gammon.com.au/forum/?id=10346

(Also see reply #16).

This does a fairly complex calculation, per pixel, and draws the result at a reasonable frame rate. (It took around 0.12 seconds to draw the image).

My point is that standard Lua isn't all that slow.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Mon 07 Jul 2014 05:15 AM (UTC)

Amended on Mon 07 Jul 2014 08:26 PM (UTC) by Nick Gammon

Message
Quote:

While a proxy DLL would seem reasonable, it's kinda out of the way as opposed to it having official support.


There was a fairly lengthy argument on the Lua mailing list about whether the DLL should be called lua51.dll or lua5.1.dll.

Personally I thought that lua51.dll was a silly name*, as it implied it was version 51 (rather than 5.1) and where would we go when we got to version 51?

However not everyone agreed. Enough did, though that some Lua libraries link against 5.1 and some link against 51, so anyone who wants to use both has to make a proxy DLL file.




* Not quite as silly as the names that Windows versions have had. In part, they were:


  • Windows 1.0
  • Windows 2.0
  • Windows 2.1
  • Windows 3.0
  • Windows 3.1
  • Windows CE
  • Windows 95 (whoa!)
  • Windows 98
  • Windows ME
  • Windows NT 3.5
  • Windows 2000
  • Windows NT 4.0
  • Windows XP
  • Windows Server 2003
  • Windows Vista
  • Windows 7
  • Windows 8


Reference: Wikipedia: Microsoft Windows

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,531 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]