I have a project where I want to manipulate certain output files.
This can be accomplished using a combination of grep and sed and piping with |
Alternatively, I can also write a C++ program to do the same thing.
Is there a conclusive answer on which method will be faster since grep and sed should already be fairly well optimised?
It generally uses a mouse to execute commands. The speed of GUI is Slower than CLI. Because the keyboard is used to execute the commands, the speed of the CLI is Faster than GUI.
CLI - Command line users only need to utilize a keyboard to navigate the interface, often resulting in faster performance. GUI - While modern GUIs are fast and efficient, they require a mouse, so you must move your hand from the mouse to the keyboard to type.
CLI is faster than GUI. The speed of GUI is slower than CLI. 5. CLI operating system needs only a keyboard.
Because it runs at terminal velocity.
From a technical standpoint, a well-written self-contained C++ program that does everything you need will be faster than using two (or more) shell commands interconnected with a pipe, simply because there will be no IPC overhead, and they can be tailor-made and optimized for your exact needs.
But unless you're writing a program that will be run 24/7 for years, you'll never notice enough gain to be worth the effort.
And the standard rules for pre-optimization apply...
If I were you, use what is already out there as these have likely been around a long time and have been tested and tried. Writing a new program yourself to do the same thing seems like a reinventing the wheel type action and is prone to error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With