Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-15 Thread Justin Israel
On Sun, 16 Oct 2016, 6:16 PM wrote: > > > On Saturday, October 15, 2016 at 6:37:08 PM UTC+8, Hotei wrote: > > re "meaningfullness" - I think he's saying that a finalizer for a function > called in a goroutine might not run if main() quits first, intentionally or > otherwise. You can of course ch

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Tamás Gulácsi
Please check your errors if you depend on the call's success! I.e. if you write into a file, f.Close must be successful, or else maybe it doesn't flush at all, and your file will be empty. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsu

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Tamás Gulácsi
Please check your errors if you depend on the call's success! -- 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 o

Re: [go-nuts] stdout to zlib and then to io.reader service

2016-10-15 Thread Tamás Gulácsi
Please cjeck your errors! Esp. That returned by cmd.Start! -- 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 opti

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-15 Thread digg
On Saturday, October 15, 2016 at 6:37:08 PM UTC+8, Hotei wrote: > > re "meaningfullness" - I think he's saying that a finalizer for a function > called in a goroutine might not run if main() quits first, intentionally or > otherwise. You can of course check for this specific case by making sur

[go-nuts] Re: Duplicate File Checker Performance

2016-10-15 Thread Sri G
Thanks. Made the go code similar to python using CopyBuffer with a block size of 65536. buf := make([]byte, 65536) if _, err := io.CopyBuffer(hash, file, buf); err != nil { fmt.Println(err) } Didn't make too much of a difference, was slightly faster. What got it to the

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Tong Sun
On Sat, Oct 15, 2016 at 5:52 PM, Justin Israel wrote: > > > On Sun, 16 Oct 2016, 8:17 AM Tong Sun wrote: > >> Hi, >> >> Need help again. >> >> I got everything tested out correctly, in https://github.com/suntong/ >> lang/blob/master/lang/Go/src/ds/PersistentData-GOB.go, but when I tried >> to appl

Re: [go-nuts] fmt.Printf not respecting String() method of elements of a struct

2016-10-15 Thread 'simon place' via golang-nuts
you could expose it to fmt, through String(), and keep it non-settable: https://play.golang.org/p/5wGsFY3Fpc -- 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 gol

[go-nuts] Re: Error handling and structured logging

2016-10-15 Thread John Jeffery
Apologies Joliee, but there is a type in that last post. The link should be https://github.com/jjeffery/kv. -- 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

[go-nuts] Re: Error handling and structured logging

2016-10-15 Thread John Jeffery
> > Thanks Chris, I would be very interested in your comments. > > I did think about submitting a PR to Go kit, but I noticed it had already > been discussed in #325. I thought I'd just work it up as a separate package > and then see if there is any interest (there has been a modest amount of

[go-nuts] Re: Duplicate File Checker Performance

2016-10-15 Thread Sri G
Too diagnose this issue, I tried some benchmarks with time tested tools: On the same directory: find DIR -type f -exec md5 {} \; *5.36s user 2.93s system 50% cpu 16.552 total* Adding a hashmap on top of that wouldn't significantly increase the time. Making this multi-processed (32 processes):

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-15 Thread Justin Israel
I've read clarifications in the past saying that finalizers can't be expected to run before your program exists, but they will run at "some point" after a gc. Or more specifically, at some point when a gc happens? Technically, for better or for worse, you could manage an atomic reference count in

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Justin Israel
On Sun, 16 Oct 2016, 8:17 AM Tong Sun wrote: > Hi, > > Need help again. > > I got everything tested out correctly, in > https://github.com/suntong/lang/blob/master/lang/Go/src/ds/PersistentData-GOB.go, > but when I tried to apply it to my real case (more complicated data > structure), it doesn't

Re: [go-nuts] regexp with ^

2016-10-15 Thread Marvin Stenger
Thanks, worked. Am Samstag, 15. Oktober 2016 22:16:14 UTC+2 schrieb Shawn Milochik: > > Escape the carat with the backslash. > > https://play.golang.org/p/SX_q0KuIvU > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this grou

Re: [go-nuts] regexp with ^

2016-10-15 Thread Shawn Milochik
Escape the carat with the backslash. https://play.golang.org/p/SX_q0KuIvU -- 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.c

[go-nuts] regexp with ^

2016-10-15 Thread Marvin Stenger
Hello, I have the problem, that I want to match expressions like: bar_f00^42 , but "[[:alpha:]]+_[[:alnum:]]+^[[:digit:]]+" won't work because of the '^'. So what are my options? Best, Marvin -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Tong Sun
On Sat, Oct 15, 2016 at 3:17 PM, Tong Sun wrote: > I've put my code at, > > http://gopkg.in/suntong/deduper.v1 > i.e., https://github.com/suntong/deduper/tree/v1.2 > FTA, README updated, see https://github.com/suntong/deduper/tree/trim -- You received this message because you are subscribed to

[go-nuts] Duplicate File Checker Performance

2016-10-15 Thread 'Kevin Malachowski' via golang-nuts
Sorry, I meant that calling Write on the hash type might be slower if it's called more often. (I'm on mobile right now. When I get back to a keyboard I'll try to come up with an example) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsub

[go-nuts] Duplicate File Checker Performance

2016-10-15 Thread 'Kevin Malachowski' via golang-nuts
It also might be inefficient to call Sum multiple times with smaller slices compared to calling it once with a larger slice. Try using io.CopyBuffer and passing in larger buffer sizes to see if the CPU and memory usage start to converge. -- You received this message because you are subscribed

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Tong Sun
Hi, Need help again. I got everything tested out correctly, in https://github.com/suntong/lang/blob/master/lang/Go/src/ds/PersistentData-GOB.go, but when I tried to apply it to my real case (more complicated data structure), it doesn't work any more. I've put my code at, http://gopkg.in/

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-15 Thread Dave Cheney
You shouldn't rely on finalisers for the correctness of your program, which is another way of saying, you shouldn't rely on finalisers. Period. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

[go-nuts] Re: High memory usage of math/big.putNat for web application

2016-10-15 Thread alb . donizetti
Does this happens on tip too? There was a recent CL that modified the code of the nat pool; see https://go-review.googlesource.com/#/c/30613/ exp. the "Eliminate allocation in divLarge nat pool" part. Il giorno sabato 15 ottobre 2016 16:28:01 UTC+2, Raffaele Di Fazio ha scritto: > > Hi, > I h

[go-nuts] Re: Error handling and structured logging

2016-10-15 Thread Jolie Rouge
At first I didn't like this idea, but the README has converted me to the possibilities. I have to admit I have a strong aversion to interface{}, and a map as well, but a lot of the other features are very interesting. I think, in a larger project, this may be just the thing for structured loggi

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-15 Thread Tong Sun
On Sun, Feb 7, 2016 at 10:18 PM, Tong Sun wrote: > > On Sunday, February 7, 2016 at 8:29:29 PM UTC-5, Michael Jones wrote: >> >> ha ha! I was typing the same thing. Matt types faster. ;-) >> > > Thank you both! > Just FTA, in case someone searches and finds this, I've collected all three aforemen

Re: [go-nuts] High memory usage of math/big.putNat for web application

2016-10-15 Thread andrey mirtchovski
As you've already determined, the memory is all allocated and kept into 'natPool', which is a sync.Pool. from the documentation: Any item stored in the Pool may be removed automatically at any time without notification. If your pool memory usage grows all the time, this is an indication tha

[go-nuts] High memory usage of math/big.putNat for web application

2016-10-15 Thread Raffaele Di Fazio
Hi, I have a web application that over time uses more and more memory. This is the output of pprof of the heap: go tool pprof -alloc_space lushan-server https: //localhost:8083/debug/pprof/heap Fetching profile from https://localhost:8083/debug/pprof/heap Saved profile in /Users/rdifazio/pprof/

[go-nuts] Re: Create a new instance by TypeOf

2016-10-15 Thread Roberto Zanotto
Yeah, it's totally fine that way. It's doing reflect.New(CollectorTypeNeed) instead of reflect.New(CollectorTypeNeed).Elem(), so that the result has type *CollectorGoogleAnalytics and can be cast to ICollector. On Saturday, October 15, 2016 at 6:26:21 AM UTC+2, Paulo Coutinho wrote: > > Hi, > >

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-15 Thread Hotei
re "meaningfullness" - I think he's saying that a finalizer for a function called in a goroutine might not run if main() quits first, intentionally or otherwise. You can of course check for this specific case by making sure all your goroutines are cleaned up before exiting main - but in some (

[go-nuts] Duplicate File Checker Performance

2016-10-15 Thread Sri G
I wrote a multi-threaded duplicate file checker using md5, here is the complete source: https://github.com/hbfs/dupe_check/blob/master/dupe_check.go Benched two variants on the same machine, on the same set of files (~1.7GB folder with ~600 files, each avg 3MB), multiple times, purging disk ca

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-15 Thread digg
On Saturday, October 15, 2016 at 8:18:04 AM UTC+8, Ian Lance Taylor wrote: > > On Fri, Oct 14, 2016 at 4:08 PM, 'Peter Lam' via golang-nuts > > wrote: > > Is there someway to wait for all pending finalizers to be run? > > Not in general, no. Conceptually it doesn't make sense since, as you >