Have you ever noticed that Windows Explorer runs at the top end of CPU usage while it’s working? We’ll take a look at what’s going on here.
Thenwe’ll take a look at Windows Explorer’s CPU usage in more detail.
The Problem
You know how Windows Explorer seems to run at the top end of CPU usage while it’s working? We’ll take a look at what’s going on here.
We’ll then take a look at Windows Explorer’s CPU usage in more detail.
Table of Contents
What’s Going On?
The reason for this is simple: Windows Explorer is a program that, like most programs, is written in C++. This is the C++ version of Java, and it’s not uncommon for a C++ program to be written in a “naked” fashion. That is, it doesn’t have any classes, abstract classes, or templates. Instead, it’s just a set of functions and variables.
It’s perfectly acceptable to write a C++ program this way. However, it’s important to note that it’s much less efficient than writing a program in a class-based language such as C#, Java, or C++/CLI.
The problem is that when you compile a program written in C++, the compiler doesn’t generate the code for you. Instead, it generates an object file.
In brief, an object file is a file that contains an object representation of a program. This object representation is not in a machine-readable format; instead, it’s a set of binary data.
The compiler then combines all of the object files together into a single executable. The result is that the program doesn’t really run in a machine-readable format. Instead, it’s just a bunch of binary data that’s compiled into an executable.
The Problem: Inefficient Use of CPU
The problem is that when a program is compiled this way, it can’t be easily optimized.
Consider the following example:
This is the C++ version of the above C# example. As you can see, the C++ version doesn’t have any classes, abstract classes, or templates. Instead, it’s just a set of functions and variables.
The above program isn’t very efficient. In fact, it’s downright inefficient. The reason for this is that when a program is compiled this way, it can’t be easily optimized.
But we’ll get to that in a moment.
The Solution
Fortunately, there’s a solution to this problem.
As you can see, the above program is much more efficient. In fact, it’s much more efficient than the C++ version. This is because when a program is compiled this way, it’s much easier to optimize.
In fact, the compiler does most of the work for you.
In brief, when you compile a program this way, the compiler generates an object file for each function in the program. This object file contains the code for the function, along with the code for the variables that are used in the function.
When the compiler combines all of these object files together into a single executable, it’s as if the compiler generated code for each function in the program. This code is machine-readable, and it’s optimized for the specific machine that’s running the program.
In short, this means that the program runs more efficiently.