Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
If you have to access just a few files, your method is probably already good enough.

If not, I can think of two methods to speed it up, both allow you to use all-lowercase filenames in your program:

1) Whenever your program starts, it checks whether there are still mixed-case filenames around (just check one file) and if yes, changes them all to lowercase (or uppercase if you prefer that). This means that when someone starts your program the first time with the downloaded data files, your program needs a little longer to start up. The next time all the files are already lowercase.

2) Generate a hash at startup that has the lowercased filename as key and the (real) mixed case filename as value. To access a file, look it up in the hash. The hash has to be generated whenever someone starts the program, but it shouldn't be a noticable delay because the program has to make just one sweep of the files on disk.

PS: Both algorithms need to do a sweep of the data files on disk. You might use File::Find to do this.


In reply to Re: Legacy Data Files on a Case-sensitive File-system by jethro
in thread Legacy Data Files on a Case-sensitive File-system by pobocks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (3)
    As of 2018-11-18 10:51 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My code is most likely broken because:
















      Results (205 votes). Check out past polls.

      Notices?