Re: [go-nuts] buffered io.ReaderAt

2017-09-16 Thread Sebastien Binet
ah! I thought I had scrutinized your repos for such a thing (you usually
have quite the gems over there) but overlooked that one.

thanks.

sadly, the improvement wasn't impressive (probably a testimony to the
performances of the linux filesystem layer...)
copying the whole file's content into a []byte and building my own
reader+readerat on top of that got me the same perfs than with your libs.

now, my biggest time consumers are:

ROUTINE  go-hep.org/x/hep/rootio.(*LeafD).readBasket
in /usr/lib/go/src/encoding/binary/binary.go
 3.25s  3.25s (flat, cum) 18.83% of Total
 .  .121:}
 .  .122:
 .  .123:func (bigEndian) Uint64(b []byte) uint64 {
 .  .124: _ = b[7] // bounds check hint to compiler;
see golang.org/issue/14808
 .  .125: return uint64(b[7]) | uint64(b[6])<<8 |
uint64(b[5])<<16 | uint64(b[4])<<24 |
 3.25s  3.25s126: uint64(b[3])<<32 | uint64(b[2])<<40 |
uint64(b[1])<<48 | uint64(b[0])<<56
 .  .127:}

which compiles down to:

  70ms   70ms 4f028d: ANDQ SI, BX ;
go-hep.org/x/hep/rootio.(*LeafD).readBasket rbuffer.go:307
 .  . 4f0290: CMPQ $0x7, DX
;binary.go:124
 .  . 4f0294: JBE 0x4f02e1
 .  . 4f0296: MOVQ 0(DI)(BX*1), DX
 ;binary.go:126
 3.25s  3.25s 4f029a: BSWAP DX;
go-hep.org/x/hep/rootio.(*LeafD).readBasket binary.go:126
  90ms   90ms 4f029d: MOVQ DX, 0x38(SP)   ;
go-hep.org/x/hep/rootio.(*LeafD).readBasket rbuffer.go:308

so probably not much to be gained here...

the profile is here:
 https://cern.ch/binet/go-hep/rootio.cpu.pprof
 https://cern.ch/binet/go-hep/read-data.go

(if anyone's interested in making that program as fast or even faster than
the C++ one... it's for science! :P)

-s

On Sat, Sep 16, 2017 at 2:05 PM, Jan Mercl <0xj...@gmail.com> wrote:

> On Sat, Sep 16, 2017 at 1:52 PM Sebastien Binet 
> wrote:
>
> > Has anybody written a buffered version of an io.ReaderAt ?
>
> IIUC what's needed, you might want to try https://github.com/cznic/
> file/blob/efffc965e97bbf31b0ed00deb82fe697500f22b5/file.go#L1039
>
> --
>
> -j
>

-- 
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.


Re: [go-nuts] buffered io.ReaderAt

2017-09-16 Thread Jan Mercl
On Sat, Sep 16, 2017 at 1:52 PM Sebastien Binet  wrote:

> Has anybody written a buffered version of an io.ReaderAt ?

IIUC what's needed, you might want to try
https://github.com/cznic/file/blob/efffc965e97bbf31b0ed00deb82fe697500f22b5/file.go#L1039

-- 

-j

-- 
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.