[go-nuts] Re: Having difficulty converting []byte to float

2018-05-18 Thread Tashi Lu
There is a function for this in the math lib Float64Frombits, a similar question: https://stackoverflow.com/questions/22491876/convert-byte-array-uint8-to-float64-in-golang On Friday, 18 May 2018 10:31:11 UTC+8, John Fox wrote: > > Hello all. I am creating a custom exporter for FreeNAS > https

[go-nuts] os/exec always fails with fork/exec /usr/bin/qemu-img: invalid argument

2018-05-11 Thread Tashi Lu
Hi gophers, I faced a strange problem: os/exec always fails with `fork/exec /usr/bin/qemu-img: invalid argument'. Simplified code is at https://play.golang.org/p/v1APfzmS2p9. It seems this simplified snippet runs well without errors, but my real code is no more than just some variable initial

Re: [go-nuts] Why does the parallel version of a program runs slower?

2018-04-16 Thread Tashi Lu
ll # new code >> >> real 0m3.374s >> user 0m5.129s >> sys 0m0.016s >> >> $ time ./t 20 > /dev/null # your original non-concurrent program >> >> real 0m4.593s >> user 0m4.538s >> sys 0m0.019s >> >> >> >&

Re: [go-nuts] Why does the parallel version of a program runs slower?

2018-04-16 Thread Tashi Lu
ncy: > > https://play.golang.org/p/lKYSbuK79sB > > $ time ./tt 20 > /dev/null # new code > > real 0m3.374s > user 0m5.129s > sys 0m0.016s > > $ time ./t 20 > /dev/null # your original non-concurrent program > > real 0m4.593s > user 0m4.538s > sys

[go-nuts] Why does the parallel version of a program runs slower?

2018-04-16 Thread Tashi Lu
Hi all, As a newbie I tried to implement a simple program calculating the Catalan numbers, which are the numbers satisfying the recursion equation c(1) = 1; c(n) = c(n - 1) * c(1) + c(n - 2) * c(2) + ... c(1) * c(n). At first, I implemented it without channels: package main import ( "fmt"