On Thursday, February 2, 2017 at 2:04:23 PM UTC+8, ChrisLu wrote: > > Go's type assertion seems quite slow. The added cost is too much if it has > to be in a tight loop. Here are the time taken on my laptop for the > following code. > > https://play.golang.org/p/cA96miTkx_ > > > chris$ time ./p > count=1073741824 time taken=7.899207181s > count=1073741824 time taken=300.601453ms > > real 0m8.205s > user 0m8.163s > sys 0m0.029s > > chris$ time luajit -e "count = 0 > > for i=1, 1024*1024*1024, 1 do count = count + 1 end > > print(count)" > 1073741824 > > real 0m0.900s > user 0m0.891s > sys 0m0.005s > > > Type assertion is even slower than call dynamic method: https://play.golang.org/p/jUrazcbB9h Some surprised.
-- 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.