Re: hash table usage questions



On Tue, 30 Dec 2008 10:56:04 -0800 (PST), "freesoft12@xxxxxxxxx" <freesoft12@xxxxxxxxx> wrote:


Here are the answers to the questions that Tim, Ted had asked:

My Perl project description:

I'm pretty sure I asked the question.

1) I get thousands of files (lets call them: TFILES) from a C++
program

There is no such thing as a C++ program. There are only programs
written in C++ (or other languages).

that prints out all the files, being opened by the program
over a period of time, to a log.

The executable in question prints out entire files to a log file?
What files are they, and where do they come from? Over and over again
huh? And they are .c or .cc or .cpp files to boot. Thousands of times
over and over and over and over again huh? What about the file names,
same thing.. thousands and thousands of times over and over again?

Hence there are several TFILES that
are opened many times.

Thousands and thousands of times, over and over again...

2) My Perl script analyzes the TFILEs and collects & publishes various
statistics about each of the TFILEs.

You havn't got a script, thats why you post here. You never have a script,
thats why you post here. Its pretty clear why you post here...
Now your publishing statistics.

3) the user can specify one or more filters (containing one or more
regular expressions) so that they can see the statistics about a
subset of TFILES (say, just *.cc and *.cpp files).

So the user can specify regular expression filters to parse said thousands
and thousands of said published statistics of said thousands and thousands
of said file's opened by a C++ program. Say like *.c or *.cc or *.cpp or *.cxx..
Not too regy expressionist.

4) the filters can be specified in the foll 3 ways:
a) on the command line
- All filters are specified on the command line. Hence, I can
populate the hash table with just the TFILEs that match the filter(s)

You really can't pass in regular expressions from the command line.
For reasons I won't go into, its extremely limited and virtually useless.
The mechanics for such uselessness far outweights the uselessness itself.

b) interactively, from a Perl-Tk GUI

Perhaps you should do a native program with real controls using C++.

- For this case, I need to read in all the TFILEs into the
hash table and show the TFILEs to the user in the GUI. The user then
enters the regular expressions to create a filter file. I apply the
filter file and remove the filtered-out TFILEs from the hash table and
show the reduced hash table to the user again in the GUI.

But, how do you get all those published statistics for thousands and
thousands of files, over and over and over.

My Question: My results show that there is quite some time spent in
copying the keys in the hash to the Perl-Tk GUI (once for creating the
filters) and then again, to show the filtered results.

Generally, there is no blocking in the control. If you have thousands
and thousands and thousands to populate a list control with, perhaps
a timer will help to populate it with, and/or use messages.

Regards
John

As a long, long, long time C programmer, I notice your focus is on C
source files. Statistically speaking, there are only a few categories
that your intentions fall into. One is Source Control type. If not
actually trying to implement a flavor of your own..., then trying to gleen
results from existing output, possibly a command line version with its own
script language, that spits out reems and reems of data and statistics.

The other is, your just plain nuts.
Its not good enough to spew buzzwords and hypotheticals and expect
thought to be applied, on your behalf, without respect #1 and humility #2.

sln

.



Relevant Pages

  • Re: hash table usage questions
    ... You just need a hash with filenames as keys. ... fc> 2) My Perl script analyzes the TFILEs and collects & publishes various ... fc> 3) the user can specify one or more filters (containing one or more ... fc> hash table and show the TFILEs to the user in the GUI. ...
    (comp.lang.perl.misc)
  • Re: optimizing file i/o
    ... Don't create the regular expressions freshly each time. ... Rather than using a hashtable, consider having an array of ints ... just increment the relevant int - no hashtable lookup, ... If most lines in the file will match one of the filters, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: do not understand the questions
    ... what is the meaning of hash value? ... > A statistical program is one having to do with statistics. ... The second question is to ... > Ex 4.7 tells you to write a function to solve the chi square function. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: 0x80072efd WU V5 trying to load 192.168.1.1
    ... Generic MM Filters ... > netsh interface ip show type=LSP ... The following commands are available: ... show interface - Displays IP interface statistics. ...
    (microsoft.public.windowsupdate)
  • ng_one2many.c
    ... Hash: SHA1 ... I was happy to configure ng_one2many on my fbsd box, ... collect statistics about the many* links of such a node, ...
    (freebsd-net)