You have ...
if $flag then $refsize=`getsize()` # getsize is a subprogram # that gets the size of the file $newsize=$refsize;
How does getsize() know which file to process?
When you call getsize(), a new shell is started up, configured, the getsize program is loaded from disk or from cache, and then it runs. That takes a relatively long time, and occurs often, once for each file. Why not use the built-in stat() function. You still have one disk access, either way, but save an unneccessarily wasted quarter second per file. Optimizing too early is a mistake, but there's no need to throw away time doing things that are already built into your language.
--
TTTATCGGTCGTTATATAGATGTTTGCA
In reply to Use your language built-in features
by TomDLux
in thread Getting started -- hashes!
by shamala
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |