Mod threads

Post Reply
User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Mod threads

by neko259 » Post

Does minetest use one threads for all mods now or a thread per each mod?

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Mod threads

by Krock » Post

neko259 wrote:Does minetest use one threads for all mods now or a thread per each mod?
Lua runs on one thread - you can notice the lag when a Lua mapgen generates terrain.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Post

Krock wrote:
neko259 wrote:Does minetest use one threads for all mods now or a thread per each mod?
Lua runs on one thread - you can notice the lag when a Lua mapgen generates terrain.
Does anyone work to make it use more threads? I think this would greatly improve performance. Or am I wrong?

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Mod threads

by Krock » Post

neko259 wrote:Does anyone work to make it use more threads? I think this would greatly improve performance. Or am I wrong?
The serverlist already uses async HTTP requests to get the data.
I'm not sure if the threads could conflict each other.
You can start developing anytime.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Post

Krock wrote:You can start developing anytime.
I'm not very familiar with C++, and can do almost nothing for multithreading in lua. If minetest was in python or java...

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Mod threads

by rubenwardy » Post

In the sims 3, each object has its own thread. It works because they can request a resource and lock it.

You would need to completely redesign the modding API. It is very unlikely to happen.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Post

rubenwardy wrote:In the sims 3, each object has its own thread. It works because they can request a resource and lock it.

You would need to completely redesign the modding API. It is very unlikely to happen.
Why do you have to break or change anything? The only thing that will be locked is working with the server (and the locking can be done on the server without changing mods api).
If you mean that one mod can use other mod, I can agree. But in that case, we can at least make a separate thread for all mods, not make them work in the same thread as server.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Mod threads

by Linuxdirk » Post

neko259 wrote:If minetest was in python or java...
I’m happy that it isn’t. Python is awesome and Java is …uhm … versatile … in a way. But both aren’t optimized for performance.

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Post

Linuxdirk wrote:
neko259 wrote:If minetest was in python or java...
I’m happy that it isn’t. Python is awesome and Java is …uhm … versatile … in a way. But both aren’t optimized for performance.
Don't judge them on the software you seen on the internet. They can be very perfomant, but you won't see good optimized java applications that are used in enterprise.

User avatar
Linuxdirk
Member
Posts: 3219
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Mod threads

by Linuxdirk » Post

neko259 wrote:They can be very perfomant, but you won't see good optimized java applications that are used in enterprise.
Every good Java fanboy knows: “Java is the fastest programming language in the world, programmers just do it wrong all the time”. Same with Python fanboys (I’m sometimes one of them, but only a little *g*).

The problem is: Both languages are interpreted. Interpreted languages are always slower than compiled languages performing the same task.

I’m happy that the Minetest code is written in a compiled language for all the critical tasks. I wish mods would use Python instead of Lua but that’s not that much of a problem since Lua is pretty easy to understand.

User avatar
neko259
Member
Posts: 805
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Post

Linuxdirk wrote:The problem is: Both languages are interpreted. Interpreted languages are always slower than compiled languages performing the same task.

I’m happy that the Minetest code is written in a compiled language for all the critical tasks. I wish mods would use Python instead of Lua but that’s not that much of a problem since Lua is pretty easy to understand.
This is true in words, but in real life the difference between 99.5% and 100% performance is not always seen. And interpreted languages can speed up development (even optimizations development) and make mistakes less frequent. I don't think percents of speed in some places are more important that the absense of segfaults.

User avatar
ArguablySane
Member
Posts: 116
Joined: Sun Oct 12, 2014 21:29

Re: Mod threads

by ArguablySane » Post

Linuxdirk wrote:I’m happy that the Minetest code is written in a compiled language for all the critical tasks. I wish mods would use Python instead of Lua but that’s not that much of a problem since Lua is pretty easy to understand.
Honestly I'd rather write mods in Java, not because I prefer the language but because it would be faster. When trying to do iteration-heavy mapgen in lua I'm always conscious of the fact that it's going to run significantly slower than native code.
The above post and any ideas expressed therein are released to the public domain under a Creative Commons CC0 license.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: Mod threads

by rubenwardy » Post

Ironic how ruby is more pythonic than python. In my opinion, anyway. (As long as you use it right, of course)
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests