控制台应用程序的运行速度是否比GUI应用程序快? [英] Do console apps run faster than GUI apps?

查看:662
本文介绍了控制台应用程序的运行速度是否比GUI应用程序快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对编程世界比较陌生。我有几个性能问题:

I am relatively new to world of programming. I have a few performance questions:


  1. 控制台应用程序的运行速度比具有图形用户界面的应用程序快吗?

  1. Do console apps run faster than apps with a graphical user interface?

C和Pascal之类的语言是否比面向对象的语言(如C ++和Delphi)更快?我知道语言速度取决于编译器而不是语言本身,但编译器的过程语言生成比OO(包括可以产生C代码的C ++编译器)更快的代码。

Are languages like C and Pascal faster than object oriented languages like C++ and Delphi? I know language speed depends more on compiler than on language itself, but do compilers for procedural languages produce faster code than OO ones (including C++ compilers that can produce C code)?


推荐答案


做控制台应用程序比基于Windows的应用程序运行速度更快

do console apps run faster than windows based app

简答:

长答案:

Short answer: No
Long answer:

基于控制台的应用程序,没有GUI线程需要重新绘制窗口和接受用户输入,所以在这个意义上,控制台应用程序可能会稍快一些(因为它有一个更少的线程窃取CPU周期)。但是,由于现代操作系统同时运行多个进程,无论如何,控制台应用程序仍然会与系统中的其他进程竞争CPU。

In a console based application, there is no GUI thread that needs to repaint the windows and accept user input, so in that sense, a console application may be slightly faster (since it has one fewer thread stealing away CPU cycles). However, since modern operating systems run multiple processes concurrently, anyway, a console application would still be contending for the CPU with other processes in the system, so no.


是像c和pascal这样的语言比面向对象语言如c ++和delphi更快?

are languages like c and pascal faster than object oriented languages like c++ and delphi?



长答案:

Short answer: No
Long answer:

C和C ++中的等效程序执行大致相同。虽然编程语言肯定会在性能上发挥作用,但通常你需要担心的主要事情是算法(您使用应用程序逻辑表达的内容),而不是算法编码的语言。

Equivalent programs in C and C++ perform roughly the same. Although programming languages certainly can play a role in performance, generally the main thing you need to worry about is the algorithm (what you are expressing with your application's logic) and not the language the algorithm is coded up in.

这篇关于控制台应用程序的运行速度是否比GUI应用程序快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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