为什么控制台输出这么慢? [英] Why is console output so slow?

查看:201
本文介绍了为什么控制台输出这么慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在Windows XP,Vista和7上使用几种不同的语言时,我已经注意到了这一点。如果每秒将几千行转储到控制台窗口中,通常会对系统性能产生负面影响。计算机速度很快,并且总是更快,而控制台看起来就像是一些背景文字。瓶颈在哪里?

So I have noticed this while using a few differnt languages on Windows XP, Vista and 7. If you dump a couple thousand lines a second to the console window it generally has a negative impact on the performance of the system. Computer are fast, and always faster, and the console looks like just some text on a back ground. Where is the bottle neck?

推荐答案

printf 等必须通过某种 IPC进行处理到控制台窗口进程(csrss或conhost),控制台也可以与多个进程共享,因此还需要进行一些同步和缓冲。

printf etc has to go from your process with some sort of IPC to the Console window process (csrss or conhost) The console can also be shared with several processes so there is also some synchronization and buffering going on.

这篇关于为什么控制台输出这么慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆