Re: Dynamic directory handles?



IanW <whoever@xxxxxxxxxxxxx> wrote:
> "Tad McClellan" <tadmc@xxxxxxxxxxxxxx> wrote in message
> news:slrndqlck1.71n.tadmc@xxxxxxxxxxxxxxxxxxxxxxx


>> 3) There is an already-invented (and tested) wheel for doing
>> recursive directory searching, the File::Find module.
>
> The only thing that sometimes puts me off using modules for relatively
> simple things like this, is that I wonder how much extra resources they use
> or whether they compromise performance in some way.


Cost to spend extra CPU cycles: $0.000001

Cost to develop code that saves those cycles: $1000.00

Your program will have to execute an awfully large number of
times for your approach to be economical.

Having a room full of programmers working on shaving off a few
cycles or bytes was commonplace in the '70s, but nowadays cycles
are cheap, RAM is cheap, what is expensive is your salary.

(though payday may make you argue that you are not expensive enough. :-)


> That is, File: Find must
> be quite a sizable module with a stack of function/options, so couldn't that
> mean lots more memory to run,


Does your application have to run on a cell phone or some other
place where RAM costs a premium?


> or is that an incorrect presumption?


It was correct 30 years ago, but it has changed due to Moore's Law.


>> If $fl is a symlink to a "higher" directory, then your
>> code will go into an infinite loop here.
>
> it's a script that will only run on my Windows servers, so that wasn't an
> issue


Windows does not have symbolic links?


> is there any particular reason you use
> single quotes there instead of double quotes?


Yes, I use single quotes unless I require one of the two extra
things (escapes and interpolation) that double quotes brings with it.


> I tend to use "" for pretty
> much everything.


Some strings contain variables, some strings don't.

During debugging, you are very often looking for variables.

You have to examine _every_ string, looking for variables.

I get to skip careful examination of many strings, because
they have been marked "no variables here" by the single quotes.

ie. it enables faster debugging.


> Also, I don't ever seem to use "||" - "or" would work as
> well in that scenario wouldn't it?


What happened when you tried it?


--
Tad McClellan SGML consulting
tadmc@xxxxxxxxxxxxxx Perl programming
Fort Worth, Texas
.



Relevant Pages

  • Re: What are my options for dictionary hashing?
    ... Does counting up the length cost any cycles (C-style null terminated ... strings), or is the length already stored? ...
    (comp.lang.forth)
  • Re: Handling Strings in SQL server
    ... First, if your application has problems with the "O'Malley" issue (imbedded single quotes in strings), you need to address the problem at the root. ... Consider than if your code permits users to enter strings with embedded single quotes, they can also introduce SQL injection attacks. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to deal with "{" in system("...command..."); ?
    ... I want to replace all strings of one blank followed by 8 dots ... You could use single quotes instead of double quotes, ... There's perhaps a better and shorter format of this command. ...
    (comp.lang.perl.modules)
  • Re: [PHP] Re: optimilize web page loading
    ... >>> doubles for the email. ... because the strings are not concatenated before output. ... adapting to using echo (to the ob to avaoid printing forty ... So, it looks like for echoing at least then single quotes are actually marginally slower than double quotes, and interpolation is faster. ...
    (php.general)
  • Re: Does PHP have an end-of-file problem.
    ... If you switch to single quotes, the PHP interpreter won't ... execute variable interpolation on strings on which it's not needed. ...
    (comp.lang.php)