• 请不要在回答技术问题时复制粘贴 AI 生成的内容
chy373180
V2EX  ›  程序员

请教下, golang 写的 Fizz Buzz 怎么这么慢

  •  
  •   chy373180 · Nov 2, 2016 · 2262 views
    This topic created in 3479 days ago, the information mentioned may be changed or developed.

    http://imgur.com/a/fDU6Y

    我的姿势问题?

    Supplement 1  ·  Nov 3, 2016
    问了下 leetcode 的管理员,终于解开了疑问。
    Moreover, the distribution graph is more useful when to compare the solution to others which are of the same language.

    We treat languages differently when judge, perhaps your golang solution runs 100 times and python run only 10 times. That's possible.
    6 replies    2016-11-03 09:35:48 +08:00
    holyghost
        1
    holyghost  
       Nov 2, 2016
    My Submissions for Fizz Buzz

    Submit Time Question Status Run Time Language

    2 weeks, 3 days ago Fizz Buzz Accepted 3 ms java

    2 weeks, 6 days ago Fizz Buzz Accepted 4 ms java

    姿势对不对,取决于你的代码是怎么写的。
    chy373180
        2
    chy373180  
    OP
       Nov 2, 2016
    @holyghost 不是啦 我的代码就是一般的写法,没什么问题。主要是想让大家看下平均水平,你看 python 的平均时间明显还要短于 golang ,跟我想的不大一样,觉得 golang 不是应该和 java c++一个量级么
    janxin
        3
    janxin  
       Nov 2, 2016
    我的答案只加一个字母就能从击败 20%到击败 80%,很多还是优化问题。算法重要的还是思路,优化基本是经验问题。
    reus
        4
    reus  
       Nov 2, 2016
    这只能说明这个测试不能反映出 go 的性能水平。
    JohnSmith
        5
    JohnSmith  
       Nov 3, 2016 via iPhone
    pporf
    loolac
        6
    loolac  
       Nov 3, 2016
    像是没有编译, go run 执行的 ~~~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3265 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 50ms · UTC 13:31 · PVG 21:31 · LAX 06:31 · JFK 09:31
    ♥ Do have faith in what you're doing.