Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- From: Serge Hulne <serge hulne gmail com>
- To: Jim Peters <jim uazu net>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala
- Date: Tue, 12 Jul 2011 17:11:08 +0200
Absolutely correct !
Hence the term "speculation"
Moreover, if efficiency was paramount, the whole construct would have to be
implemented at lower level (in C not in Vala).
Another reason why these speculations cannot possibly add anything
performance-wise is that I don't think (I might be wrong) that Vala can be
tailored specifically for a given multi-core architecture. In this case,
using threads can be convenient, but it will not process tasks in parallel,
therefore threads can only slow down the execution of an application.
Last but not least goroutines are indeed more lightweight than threads (they
use threads but they are not threads).
So basically it was just for convenience (and for fun) !
Serge.
On Tue, Jul 12, 2011 at 2:43 PM, Jim Peters <jim uazu net> wrote:
Serge Hulne wrote:
Here is a further development of the idea of Luca Bruno about a Vala
implementation for Generators:
Simulating Go's goroutines and channels in Vala:
Basically the idea is to start as many threads as needed (which play the
role of Go' goroutines) and to recuperate their output from a "Generator"
(which plays the role of the "Go" channel form which the result from a
given
thread can be pulled):
Threads are very heavy compared to an optimised implementation of
'goroutines' or whatever. Certainly you can emulate them but it's not
going to be an efficient way of implementing algorithms unless someone
puts in the work to make it efficient under the hood.
If convenience matters more than efficiency, then no problem.
Jim
--
Jim Peters (_)/=\~/_(_) jim uazu net
(_) /=\ ~/_ (_)
UazĂș (_) /=\ ~/_ (_) http://
in Peru (_) ____ /=\ ____ ~/_ ____ (_) uazu.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]