|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Shell script and Big O notation
I am wondering why big O notation is not being emphasized in shell script context. But its almost discussed in all OOP languages,
Please shed your thoughts, Thanks |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Shell sits on top of so much other stuff, that anything that would merit O notation would already be in a low level language where you can directly control all of the "stuff", like I/O, buffering, memory ordering, etc.
Shell also suffers from performance degradation when coders are oblivious to the cost of process creation - e.g., writing loops that iterate over a miilion lines of a file, with dozens of external commands embedded, instead of using builtins and keywords. |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
So how we can measure the performance of a script in general?
|
|
#4
|
||||
|
||||
|
One parameter would be to measure the time taken to run the script.
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Big O notation does not in itself provide you with any useful performance information; it's merely one characteristic of an algorithm's complexity.
O(n) is usually better than O(n^2), but if you're working on a small data set and the O(n) approach requires some expensive setup to begin, the O(n^2) solution could be the better choice. In the end, you need to test the code with what will be a typical workload, under typical operating conditions, on typical hardware. Regards, Alister |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Do we have any shell built in feature to measure the execution time of a script rather than manually monitoring ?
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
time
Regards, Alister |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unsure of sed notation (nu\\t.\*) | czar21 | Shell Programming and Scripting | 3 | 07-20-2011 04:52 PM |
| Convert decimal notation to ANSI point code notation | aavam | Shell Programming and Scripting | 4 | 06-28-2011 09:16 PM |
| IP Address Notation | JerryHone | IP Networking | 5 | 02-18-2011 01:19 AM |
| Sorting exponential notation | NilsMueller | Shell Programming and Scripting | 15 | 09-14-2010 01:40 AM |
| Rounding scientific notation | ppat7046 | Shell Programming and Scripting | 4 | 06-10-2009 02:20 PM |
|
|