News for hackers. Stuff that matters.
Re:Show HN: Concurrency-safe file-backed element store in Go by gophernaught on Saturday February 28, 2015 @11:09AM (#9124032)
I like it, though I think it's likely to create a lot of garbage, what with spawning a goroutine on each Put, I suppose that's probably not an issue for most programs.

I find defer pretty expensive, I don't use them that liberally anymore, only when they're really called for.

Bug: defer fh.Close() without error checking in put(). This can result in data loss. It would also be nice to at least have the option of doing synchronous stores, possibly even with an os.Sync().

Re:Show HN: Concurrency-safe file-backed element store in Go by sebcat on Sunday March 01, 2015 @12:57AM (#9126198)
> I find defer pretty expensive, I don't use them that liberally anymore, only when they're really called for.

I use defer a lot so I decided to test your statement, and you were right. The testcase is not representative of the functionality in github.com/sebcat/store. here it is: https://pastie.se/e4352d50

BenchmarkNoDefer 10000000 177 ns/op

BenchmarkDefer 2000000 633 ns/op

ok foo 3.874s

Re:Show HN: Concurrency-safe file-backed element store in Go by gophernaught on Saturday February 28, 2015 @11:30AM (#9124111)
Whoops, by os.Sync() I meant *File.Sync() of course, aka fsync.
Re:Show HN: Concurrency-safe file-backed element store in Go by sebcat on Saturday February 28, 2015 @11:09PM (#9126007)
Thanks!