LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-22-2023, 02:39 PM   #1
shirase
LQ Newbie
 
Registered: Nov 2023
Distribution: Linux for PlayStation 2
Posts: 8

Rep: Reputation: 0
Question Sourcing Multiple Languages & Cyclomatic Complexity


I've been trying to optimize blocks of code originally written in shell script.
I converted these blocks into perl, awk, and sed files and later compared them in file size, preformance and execution time.
Now I source the individual files as needed throughout the shellscript.
But I'm wondering, if I create a script that sources a perl script, an awk script, a sed script, then would that increase the cpu/gpu/ram usage and slow down the execution time?
 
Old 12-23-2023, 10:46 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Measure the MIPS.

As part of your efforts with optimizing these scripts you must have learned where high load tendencies are, be they dispatch logic, computations, loops, file operations, or other things. And further, there's little point attempting to optimize execution time if you haven't determined what was formerly consumed, as well as what is consumed now.
 
Old 12-23-2023, 12:05 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
@shirase, I heartily applaud what you are doing, and I have done it many times myself. "CPU/GPU/RAM usage" – these days – is entirely irrelevant (IMHO) in contrast with the purely human(!) considerations of clarity.

The only "shell" that I am aware of which attempted to include a "serious" programming language was Dr. Korn's ksh, which today is rarely used or even spoken of. The very-primitive scripting capabilities of bash certainly do not qualify. But, this is precisely why we have the "#!" ("shebang") feature, which allows any(!) language to be used to implement "a shell script."

These days, we have "hardware resources in embarrassing abundance." But we still spend a fortune (the recipients call them, "salaries" ...) on the humans, so we do not want to waste these humans' time ... time spent "puzzling out" what the code in front of their faces actually does. (And especially, "getting it wrong.")

Now – to be fair – much of the code that we still encounter today was written at a time when "hardware resources and memory" were at an absolute premium. The programmers of that time (koff, koff ... ) did what they had to do, using the only thing they had: toys.

As you proceed with your efforts, be sure that your team recognizes this as a formal project, and applies necessary "deployment" and "quality assurance" efforts to it.

Last edited by sundialsvcs; 12-23-2023 at 12:07 PM.
 
  


Reply

Tags
awk, optimization, perl, sed, shell



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple network sourcing Andersmaten Linux - Networking 1 08-02-2013 08:30 AM
bash script to test string complexity (like password complexity) robertjinx Linux - Server 2 05-12-2010 02:58 PM
languages of linux: which languages can be choosen in suse and red-hat distributions? Klaus Schnorr Linux - Software 3 09-10-2005 02:19 AM
Phục hồi dữ liệu bị mất???, cứ pollsite General 1 06-27-2005 12:39 PM
Gotta love those ٱٱٱٱٱٱٱ&# iLLuSionZ Linux - General 5 11-18-2003 07:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration