douhuan1905 2019-02-23 07:36
浏览 102

Windows 10 CMD中的Println输出比GoLand Console慢得多

I have written a very short and simple Go program. All it does is output 0-999999. I am very confused because the output is MUCH faster in the Console for GoLand IDE as opposed to the Windows 10 CMD. I have also tested with PowerShell and Git Bash. Both are also A LOT slower than GoLand IDE.

I'll post the code below as well as time taken from the code ran in CMD and GoLand IDE Console. Thank you.

package main

import (
    "fmt"
    "time"
)

func main() {
    start := time.Now()

    for i := 0; i < 1000000; i++ {
        fmt.Println(i)
    }

    elapsed := time.Since(start)
    fmt.Println("Time took:", elapsed)
}

GoLand IDE Console: Time took: 2.1853708s

Windows 10 CMD: Time took: 37.3894414s

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
    • ¥15 关于#hadoop#的问题
    • ¥15 (标签-Python|关键词-socket)
    • ¥15 keil里为什么main.c定义的函数在it.c调用不了
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思