Can Go really be that much faster than Python?

前端 未结 8 1629
抹茶落季
抹茶落季 2021-01-31 14:27

I think I may have implemented this incorrectly because the results do not make sense. I have a Go program that counts to 1000000000:

package main

import (
             


        
8条回答
  •  名媛妹妹
    2021-01-31 14:59

    I'm not familiar with go, but I'd guess that go version ignores the loop since the body of the loop does nothing. On the other hand, in the python version, you are incrementing x in the body of the loop so it's probably actually executing the loop.

提交回复
热议问题