You could avoid allocations altogether by reusing the same byte array and
passing it to the function.
To retain readability, use a buffer and fmt.Fprintf
On Saturday, 11 November 2017 04:00:48 UTC+13, Vasiliy Tolstov wrote:
>
> Thanks, i know that optimization can lead obscurity, but for critica
Thanks, i know that optimization can lead obscurity, but for critical
paths i think that it useful =)
2017-11-10 8:41 GMT+03:00 peterGo :
> Vasiliy,
>
> For portability, when you initialize cfg.WorkDir, clean it: cfg.WorkDir =
> filepath.Clean(cfg.WorkDir)
>
> You can reduce the allocations from 5
Thanks!
2017-11-10 3:52 GMT+03:00 krolaw :
> func oid2filepath(cfg *Config, oID uint64) string {
>return fmt.Sprintf("%s%c%x%c%016x", cfg.WorkDir, filepath.Seperator,
> oid2vid(oID), filepath.Seperator, oID)
> }
>
> On Friday, 10 November 2017 09:58:03 UTC+13, Vasiliy Tolstov wrote:
>>
>> Hi.