Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ replace lua5.1.dll with the one from luajit 2.0.0-beta5

replace lua5.1.dll with the one from luajit 2.0.0-beta5

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


Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Mon 22 Nov 2010 07:24 PM (UTC)
Message
why not?

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 22 Nov 2010 08:41 PM (UTC)
Message
With what purpose? Speed I presume? Well you could try it for yourself, let us know how it goes. Last time I looked into luajit it seemed a bit flaky (that was a while ago).

I note that you are suggesting replacing a stable Lua 5.1.4 with beta code. Isn't that asking for trouble?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #2 on Mon 22 Nov 2010 08:44 PM (UTC)
Message
It's beta, for one. For another, there is a breaking difference (though rarely used and officially deprecated in Lua 5.1 anyways) where the 5.0 version of '...', a pseudo-variable called 'arg', is actually not implemented. So any scripts that use that old-style form will break. Finally, there most likely need to be changes in the MUSHclient source code to take full advantage of LuaJIT's advanced features.

It's fun to play with on a user-by-user basis (not that I have), and I believe it's binary-compatible with Lua 5.1 (as in the lua_* functions). I'd be a little surprised to see it adopted as the official Lua for MUSHclient though.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #3 on Mon 22 Nov 2010 08:46 PM (UTC)
Message
Nick Gammon said:
a bit flaky (that was a while ago).

Playing devil's advocate, I've heard a lot of good things about LuaJIT, and I haven't heard much about it being "flaky". It's under constant development AFAIK. But I've never used it, so this is more or less based on what I've heard people say.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 22 Nov 2010 08:52 PM (UTC)
Message
From their web page:

http://luajit.org/status.html


Quote:

The JIT compiler only generates code for CPUs with support for SSE2 instructions. I.e. you need at least a P4, Core 2/i5/i7 or K8/K10 to get the full benefit.

...

Obviously there will be many bugs in a VM which has been rewritten from the ground up. Please report your findings together with the circumstances needed to reproduce the bug. If possible reduce the problem down to a simple test cases.

...

The JIT compiler is not complete (yet) and falls back to the interpreter in some cases.

...

Many known issues cause a NYI (not yet implemented) trace abort message. E.g. for calls to vararg functions or many string library functions.


Look, fine if it works for you. Great if it works faster than the normal Lua, and doesn't crash. If you want to try it, and report back that it not only doesn't cause any problems, but runs much faster than normal, that would be good to know.

Mind you, I virtually never look at MUSHclient and think that it is doing something too slowly. Even with Fiendish's mapper cranked up in size to take up a large swag of screen space, and a big search depth, it seems to be fast and responsive. Maybe his example of a very fast speedwalk would be a bit quicker (mind you, in that particular case the "slow" version was only 9 seconds slower, to cross a couple of continents, than the faster version).

But there is nothing stopping you dropping in the DLL and trying it, is there?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #5 on Fri 03 Jun 2011 08:04 PM (UTC)

Amended on Fri 03 Jun 2011 08:12 PM (UTC) by Fiendish

Message
Thread update. I've been packaging luajit (now at 2.0 beta7) with the aardwolf mushclient package for a while. No crashes that I know of so far. And I'm kinda excited about the FFI stuff (http://luajit.org/ext_ffi.html) for Windows API calls not directly supported by MUSHclient.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #6 on Fri 03 Jun 2011 09:53 PM (UTC)
Message
What sort of speed increase do you get with, say, the mapper? I'm talking figures here, not general impressions.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #7 on Sat 04 Jun 2011 06:26 PM (UTC)

Amended on Sat 04 Jun 2011 06:40 PM (UTC) by Fiendish

Message
I've specifically made Aardwolf's mapper drop the visible depth to 4 while running to make up for performance issues, but let's pretend for a moment like I hadn't done that.

Using the gmcp mapper that I've customized for Aardwolf...

running

local time = utils.timer()
for i=1,20 do
   mapper.draw(current_room)
end
print(utils.timer()-time)

in the center of a 19x19 continent room grid

lua takes ~4.05 seconds (4.94 times per second)
luajit 2.0.0b7 takes ~2.75 seconds (7.27 times per second)

running

local time = utils.timer()
for i=1,20 do
   mapper.draw(current_room+i)
end
print(utils.timer()-time)

(faster because this doesn't always do a full 19x19 rooms due to being at continent boundaries)

lua takes ~3.22 seconds (6.21 times per second)
luajit 2.0.0b7 takes ~2.21 seconds (9.05 times per second)

Aardwolf's clock pulses about 7.5-8 times per second, so any drawing speed lower than that means there will always be slowdown in the absolute best case of no other processing at all.

If you want to get absolutely ridiculous, though...

local time = utils.timer()
for i=1,1000000000 do math.max(1,10) end
print(utils.timer()-time)


in luajit 2.0.0b7 takes ~0.86 seconds
in lua takes ~135.79 seconds :-}

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #8 on Sun 05 Jun 2011 02:05 AM (UTC)
Message
OK, so you are getting around 50% faster on "real-world" situations. That is, your code does around 1.5 times as much as the normal Lua in a given time.

That's nice, but not earth-shattering. For example, if you are dropping the depth to 4 to walk around, now you could make it 6.

Quote:

And I'm kinda excited about the FFI stuff ...


Yes that looks cool. But the problem here is, if you start using it, then you are committing people to using the LuaJIT. At present, if LuaJIT has an issue you can just drop in the normal Lua DLL and keep going, with some speed penalty.

But just use a single reference to the FFI stuff and that fall-back position goes away.

Maybe one day some of your players will install a plugin (maybe not written by you) that just doesn't work with LuaJIT. Now you are forcing them to choose between your plugins and the other one(s).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #9 on Sun 05 Jun 2011 02:39 AM (UTC)

Amended on Sun 05 Jun 2011 02:48 AM (UTC) by Fiendish

Message
Quote:
Maybe one day some of your players will install a plugin (maybe not written by you) that just doesn't work with LuaJIT.

Maybe, but I doubt it. Anything that isn't JITed just drops back to the standard interpreter.

Quote:
Yes that looks cool. But the problem here is, if you start using it, then you are committing people to using the LuaJIT.
I've got a bit of a stranglehold on the market for Aardwolf anyway, and I don't release plugins on their own anymore. I just release snapshots of the package which people are free to use or not use. My main reason for wanting to use it is that there are certain system calls that MUSHclient doesn't itself support, like createdirectory and copyfile and shfileoperation (allows for silent recursive directory deletion among other things), because people apparently freak out and think they have a virus when they see cmd consoles flash across the screen (this is what happens when using Lua's os.execute). And I *could* bug you to add more windows api functions for Lua, but I won't because it's way obscure, and this is much simpler than making my own wrapper DLLs.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #10 on Sun 05 Jun 2011 04:50 AM (UTC)
Message
Well if it works then certainly you can do that (use the LuaJIT DLL that is).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #11 on Sun 05 Jun 2011 07:08 PM (UTC)

Amended on Sun 05 Jun 2011 07:11 PM (UTC) by Fiendish

Message
Nick Gammon said:

Well if it works then certainly you can do that (use the LuaJIT DLL that is).

The only problem I've had so far is that apparently new versions of visual studio make binaries that will not run on systems older than Windows XP. Apparently I need to get a copy of 2005 to make it work.

Quote:

Error Starting Program
The lua5.1.dll file
expects a newer version of Windows.
Upgrade your Windows version.


Bleh.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Mleo2003   (32 posts)  Bio
Date Reply #12 on Sun 05 Jun 2011 08:17 PM (UTC)
Message
Another forum I frequent had this link having a work around for just such an occasion:

http://stackoverflow.com/questions/2484511/can-i-use-visual-studio-2010s-c-compiler-with-visual-studio-2008s-c-runtime
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #13 on Sun 05 Jun 2011 10:32 PM (UTC)
Message
Fiendish said:


The only problem I've had so far is that apparently new versions of visual studio make binaries that will not run on systems older than Windows XP. Apparently I need to get a copy of 2005 to make it work.


And to think that people want me to upgrade my Visual Studio to a newer version (and pay around $2000 for the privilege).

Quote:

Error Starting Program
The lua5.1.dll file
expects a newer version of Windows.
Upgrade your Windows version.


"Upgrade your Windows version". Pay us money.

"Upgrade Visual Studio". Pay us more money.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


40,350 views.

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

Go to topic:           Search the forum


[Go to top] top

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