Mod threads

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

Mod threads

by neko259 » Sat Dec 13, 2014 19:33

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

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Mod threads

by Krock » Sat Dec 13, 2014 19:34

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.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

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

Re: Mod threads

by neko259 » Sat Dec 13, 2014 19:36

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
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Mod threads

by Krock » Sat Dec 13, 2014 19:42

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.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

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

Re: Mod threads

by neko259 » Sat Dec 13, 2014 19:44

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
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Mod threads

by rubenwardy » Sun Dec 14, 2014 11:23

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.
 

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

Re: Mod threads

by neko259 » Sun Dec 14, 2014 13:41

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: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Mod threads

by Linuxdirk » Sun Dec 14, 2014 14:04

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: 769
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Sun Dec 14, 2014 14:05

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: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Mod threads

by Linuxdirk » Sun Dec 14, 2014 14:26

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: 769
Joined: Sun Jun 19, 2011 06:51

Re: Mod threads

by neko259 » Sun Dec 14, 2014 15:40

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 » Sun Dec 14, 2014 16:30

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
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Mod threads

by rubenwardy » Sun Dec 14, 2014 16:58

Ironic how ruby is more pythonic than python. In my opinion, anyway. (As long as you use it right, of course)
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 7 guests

cron