On Friday, 10 November 2017 13:52:51 UTC+13, krolaw wrote: > > func oid2filepath(cfg *Config, oID uint64) string { > return fmt.Sprintf("%s%c%x%c%016x", cfg.WorkDir, filepath.Separator, > oid2vid(oID), filepath.Separator, oID) > } > > On Friday, 10 November 2017 09:58:03 UTC+13, Vasiliy Tolstov wrote: >> >> Hi. I have server that read/write data to many files (each is about >> 4-32Mb). To determine on which file i need to read/write i'm use this >> function to os.OpenFile >> >> func oid2filepath(cfg *Config, oID uint64) string { >> file_path := filepath.Join(cfg.WorkDir, fmt.Sprintf("%x", >> oid2vid(oID)), fmt.Sprintf("%016x", oID)) >> return file_path >> } >> >> oid2vid function get uint32 and return uint32 with shift some bits >> path looks like (for one of 4Mb chunk) store/obj/7c2b25/007c2b2500000180 >> >> When i'm write 4Gb data i need to call this function 1024 times for >> single big chunk of data. >> Does it possible to write function that does not have additional >> allocations? >> And does it possible to write it in portable way (i mean path separator). >> >> >> -- >> Vasiliy Tolstov, >> e-mail: v.to...@selfip.ru >> >
-- 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.