[go-nuts] Re: odd benchmark results for time.Now() call inside vs outside mutex

2020-02-24 Thread Jim Robinson
That's interesting!

My numbers earlier were from an AMD chip (2990WX) on Linux 5.3.11.

On an older Intel chip (i7-4960HQ) on macOS 10.15.3 I still see small a 
difference but it's much smaller.

$ go test -bench .
goos: darwin
goarch: amd64
BenchmarkStateSet1-82737468   441 ns/op
BenchmarkStateSet2-83514694   345 ns/op
BenchmarkStateSet3-83351747   356 ns/op
PASS
ok  _/Users/jimr/tmp/odd5.253s

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e8cd29b0-cff1-4feb-bf28-2c497d4a7fd5%40googlegroups.com.


[go-nuts] odd benchmark results for time.Now() call inside vs outside mutex

2020-02-24 Thread Jim Robinson
Hi folks,

I was testing some code and I noticed something that struck me as little 
odd. In the following code:

https://play.golang.org/p/z8OOCrnZ85s

we have routines Set1, Set2, and Set3.  They do the same thing, but change 
where time.Now().Unix() is called.

Set1 calls for the time before it acquires a mutex, eventually passing that 
time onto a 3rd function

Set2 calls for the time after it's acquired the lock, and passes the value 
onto the 3rd function.

Set3 calls for the time after it's acquired the lock as part of its call to 
the 3rd function.

The benchmarks for these operations is different:

$ go test -bench .
goos: linux
goarch: amd64
BenchmarkStateSet1-64 100  1156 ns/op
BenchmarkStateSet2-64 1295552   833 ns/op
BenchmarkStateSet3-64 2348185   703 ns/op
PASS
ok  _/home/jimr/tmp/odd5.739s
$ go test -bench .
goos: linux
goarch: amd64
BenchmarkStateSet1-64 100  1146 ns/op
BenchmarkStateSet2-64 3256602   603 ns/op
BenchmarkStateSet3-64 1439412   842 ns/op
PASS
ok  _/home/jimr/tmp/odd5.983s
$ go test -bench .
goos: linux
goarch: amd64
BenchmarkStateSet1-64 100  1130 ns/op
BenchmarkStateSet2-64 1772056   772 ns/op
BenchmarkStateSet3-64 2637054   433 ns/op
PASS
ok  _/home/jimr/tmp/odd6.325s

Based on the difference between Set2/Set3 I'm wondering if this is just a 
case of the numbers being small enough that it's hard to reliabily measure 
them, but I'm struck how much slower Set1 is than Set2/Set3, apparently due 
to whether or not the time.Now().Unix() call is made within the lock?  Why 
would that be?

Jim

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a457e425-2b39-4841-8490-bc7f475deeb0%40googlegroups.com.


Re: [go-nuts] Do Any Editors Support Customisable Code collapsing?

2019-07-18 Thread Jim Robinson
Is it named try? :P

On Wednesday, July 17, 2019 at 8:37:53 PM UTC-7, Michael Jones wrote:
>
> There is a special “collapse if err !=  nil blocks plugin for VS code. 
>
> On Wed, Jul 17, 2019 at 5:37 PM > wrote:
>
>> Context:
>> 1. Golang can be very verbose, for example checking if err != nil after a 
>> function call takes 3 lines:
>> if err != nil {
>>return nil, fmt.Errorf("some context: %v", err)
>> }
>>
>>
>> 2. Editors like VSCode can already collapse blocks of statements, where 
>> the above would be displayed as:
>> if err != nil {...
>>
>>
>> My question:
>> Are there any editors that support some kind of customisable collapsing 
>> behaviour? Where the above code could be collapsed to something like:
>> ...check...fmt.Errorf("some context: %v", err)...
>>
>> Has anyone tried to implement this kind of behaviour? Is it difficult to 
>> achieve?
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golan...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/e15556dd-b957-4d79-9ca4-8b6ed8eb6e6c%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
>
> *Michael T. jonesmichae...@gmail.com *
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/920a48e6-431d-40b2-8081-d0b207cb1840%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] goxpath: An XPath 1.0 parser

2017-06-14 Thread Jim Robinson
Since he was the initial author of this thread you're replying to, it does 
seem reasonable enough to also raise the question here. :)

On Wednesday, June 14, 2017 at 7:25:08 AM UTC-7, Lutz Horn wrote:
>
> Hi, 
>
> Am 14.06.2017 15:57 schrieb seamus via golang-nuts: 
> > Yes referring to https://github.com/ChrisTrenkamp/goxpath 
> > ... 
> > You would be Chris Trenkamp. 
>
> Then you will probably get better answers if you open an issue on this 
> GitHub project. The people here on go-nuts did not write this library 
> nor can they tell you what the current status of it is. 
>
> Regards 
>
> Lutz 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Minio cloud storage?

2017-06-02 Thread Jim Robinson
The https://www.minio.io/ project looks very interesting.  

It's an S3 compatible cloud storage server (and associated apis and command 
line clients), written in Go.

Have any of you folks made use of it?

Jim

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: go1.8 and json.NewDecoder(resp.Body)

2017-05-23 Thread Jim Robinson
I'd suggest the latter, drain the reader as the last step.  Perhaps define 
a DrainReadCloser that can fully drain  the input ReadCloser as part of its 
closing operation?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: TAR max file name woes

2017-05-09 Thread Jim Robinson
It looks to me as though the Writer specifically only handles the posix 
standard tar, which does indeed limit you to 100 characters.  It appears as 
though they've implemented support for reading the GNU format, which I 
think does not place limits on the name length. 
 See https://github.com/golang/go/issues/12594 for some discussion about 
the assumptions being made by the current package.

On Tuesday, May 9, 2017 at 7:42:52 AM UTC-7, Terence wrote:
>
> I am attempting to TAR a directory with relatively long file names (over 
> 100 chars long) and all I get is garbage. Is there any way to TAR a 
> directory with file paths longer than 100 chars?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: text/scanner: scan() vs peek()

2016-08-25 Thread Jim Robinson
I'll admit to not understanding how your question and code example mesh, 
but as far as I can tell Scanner.Peek is working as it is documented in the 
API, it returns the rune w/o advancing:

https://play.golang.org/p/DgzRcWeTRI

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.