Menu

#4 Cache Namelist length

open
nobody
Speedup (1)
1
2007-01-25
2006-01-30
No

Every time a names is chosen out of a file, the number
of names in this file is counted first. Create a linked
list containing
the number of names per file. In this list, there is:
World, country, file.
If we are looking for a name and no entry is in the
list, the names in the file are counted, the entry in
the list will be added.

Important: Delete list on de-init of library !

Discussion

  • Thorsten Sick

    Thorsten Sick - 2007-01-25

    Logged In: YES
    user_id=43775
    Originator: YES

    Set it to prio 1, because it is not really needed and is just a "would be nice" feature

     
  • Thorsten Sick

    Thorsten Sick - 2007-01-25
    • priority: 5 --> 1
     
  • Svartsmurfen

    Svartsmurfen - 2007-02-17

    Logged In: YES
    user_id=1428370
    Originator: NO

    Not sure I understand.
    Are we talking about a struct containing (the gaming) world, (the gaming) country and the path to the file?
    How should the list be sorted? I assume by number of posts.
    Also, if the file is the path, would you like it as a filepointer or a string (or maybe char* to be precise since string is an actual type those days and probably isn't completely standardized just yet)?

     
  • Thorsten Sick

    Thorsten Sick - 2007-02-19

    Logged In: YES
    user_id=43775
    Originator: YES

    The problem is: If I want a random name from a file, I open it, count the lines, close it.
    The I start a random command resulting in the line I want.
    The I open the file, go to this line, output it. Close the file

    Normally you want more than one name of a specified coutry. Say, 100 male names, german,
    This summs up to reading the whole file about 100 times and reading a large portion of the file 100 times.
    = 200 Times file handling.

    If we store the number of names in a file the first time we read it in some structure, we could save a lot of disc access.
    For the stand-alone tool, it is not needed. But for a library used in games, saving time is very important.

    (It is notused yet, so no hurry)

     
  • Svartsmurfen

    Svartsmurfen - 2007-02-19

    Logged In: YES
    user_id=1428370
    Originator: NO

    Okely dokely, now I get it.
    So basically any 2D char* would do (two dimensional string).
    I don't see why you should need a struct (or similar) since you already know what you are making.
    Then again it's a small job to make a single struct with a pointer to the vector-string,
    so why not.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.