P.S. shaves 20% from the total execution time. On Mon, Nov 26, 2018 at 10:22 AM <lary...@gmail.com> wrote: > > The ugly hack below shaves 20% from the switch-case > type iface struct { > tab *unsafe.Pointer > data *unsafe.Pointer > } > > func getInterfaceData(arg interface{}) unsafe.Pointer { > return unsafe.Pointer((((*iface)(unsafe.Pointer(&arg))).data)) > } > > // Cast the integer argument to uint64 and call a "writer" > // The "writer" knows how many bytes to add to the binary stream > // > // Type casts from interface{} to integer consume 40% of the overall > // time. Can I do better? What is interface{} in Golang? > // Switching to args *[]interface makes the performance 2x worse > // Before you jump to conlusions see > // https://groups.google.com/forum/#!topic/golang-nuts/Og8s9Y-Kif4 > func (b *Binlog) writeArgumentToOutput(writer writer, arg interface{}) error { > // unsafe pointer to the data depends on the data type > var err error > err = writer.write(b.ioWriter, getInterfaceData(arg)) > return err > } > > > -- > You received this message because you are subscribed to a topic in the Google > Groups "golang-nuts" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/golang-nuts/Og8s9Y-Kif4/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
-- 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.