On Tuesday, December 18, 2012 1:39:16 PM UTC+1, nguoituyet wrote:
Hi,
I have been looking for a language different from C/C++ to write a top chess program for many years. Now I really want to give GO a try. I know that at the current state, GO is not very optimized in terms of performance. My question is that:
Is there any fundamental limitation in GO which prevents it from being a good alternative to C/C++ for chess programming no matters how optimized the library can be?
There are some limitations which have to do with the absence of direct/raw memory access in Go programs, such as:
- it is impossible to implement a fast heterogenous memory allocator in Go
- there are no unions, so some direct conversions of binary values from type T to type U are impossible. For example, if T is int32 and U is [4]byte. It is possible to overcome some of these limitations by using package "unsafe" or C functions.
- compressed pointers are impossible in Go. There are also no bit fields in structs.
- some C/C++ implementations have SSE/AVX intrinsics
- Go implementations are using split stacks, so there is an additional overhead of a couple of additional instructions per function call. It is possible to remove much of this overhead in single-threaded code by improving the compiler.
If the answer for that is 'no' then I'm happy to go with GO now with the hope of more performance optimization in the future.
There are cases where highly optimized C/C++ code will be faster than highly optimized Go. The overall difference may be about N*10%, where N is a small natural number.
If about N*10% difference in performance is acceptable, it is a good choice to implement the chess engine in Go.