On Sat, Oct 1, 2016 at 12:24 AM,  <agniva.quicksil...@gmail.com> wrote:
>
> I am using a variable to track the no. of bytes written to a file so far.
> Now the fmt.Fprint command returns the bytes written as int. But I am
> thinking of storing the value as a uint64 just to give it some extra space.
> Therefore, I have to do a bytesWritten += uint64(n) to add to the variable.
>
> This code is in the hot path of my application. I was just wondering what is
> the performance hit of the casting and whether there is any better way to
> achieve this ?

Converting from int to uint64 is very cheap.  In fact, on many
processors, the performance cost is exactly zero.  Don't worry about
it.

Ian

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

Reply via email to