T
T
Toster1002015-12-29 23:42:41
go
Toster100, 2015-12-29 23:42:41

What languages ​​have analogues of goroutines in terms of performance and simplicity?

There is a Go language and it has wonderful Goroutines. For example, I wrote a simple program that performs thousands of simultaneous calls to remote nodes, while a program similar in functionality in Java or another language that uses native OS threads would eat up many times more system resources (and the Go program does not load the CPU). by more than 30% and this is on an old computer with a running browser, eclipse and other garbage and not particularly optimized).
The Go language certainly provides a convenient and seemingly unique multi-threading model (goroutines + channels), but, in my opinion, this is all the good that can be said about it. The language itself is poor, about which quite a few articles have been written.
The question is, are there real alternatives to goroutines in other languages ​​in terms of performance and overhead?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
O
Oleg Tsilyurik, 2015-12-30
@Toster100

at the same time, a program similar in functionality in Java or another language that uses native OS threads would consume many times more system resources

This is a very superficial judgment from the area of ​​\u200b\u200b"if only yes if only" ...
In some cases this is so, and in others it is completely different.
PS By the way, the Go-routine model uses native threads, and a Go program, even if it doesn't use parallelism at all, also actively uses native threads.

A
Andrey K, 2015-12-30
@mututunus

Erlang.

B
beduin01, 2015-12-29
@beduin01

Take a look at dlang.org and in particular vibed.org The syntax is much nicer than that of Go.

L
lega, 2015-12-30
@lega

Use Go where goroutines are needed, and for other tasks, the language that is more convenient for you.

U
uvelichitel, 2015-12-31
@uvelichitel

Lightweight streams at the library level are available in almost all modern languages. For the JavaVirtualMachine you mentioned, it's Akka-Skala. In Go, streams and channels are introduced into the syntax of the language, resulting in a 'select case' construct that is extremely difficult to implement in libraries. Hoare's ideology of Communicating_Secuential_Processeses is fully implemented in Erlang at the syntax level, with the difference from Go that the streams are named and can be accessed personally (only channels are named in Go). You can easily write your dispatcher on libthreads and epoll, kqueue system calls. Also, the specific task of thousands of accesses to remote nodes can be implemented with a simple cycle, which, in essence, happens under the hood, and such a particular solution to a specific task will always be more efficient.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question