Programming :: Association Lists Are Faster Than Hash Tables?

Jun 13, 2011

I'm writing an interpreter and it used simple association lists for mapping varaible names to their values. Here's the code:


#include "assoc_array.hpp"
#include <string.h>
using namespace LANG_NAMESPACE;


I thought that I would replace it with a hash table to increase performance. Note that I decided to store linked lists in the buckets instead of the actual values, in case the hash function outputs the same index for multiple variable names:


#include "hash_table.hpp"
#include "assoc_array.hpp"
#include <string.h>


It runs in about 0.333 seconds on my machine. Since I'm using git version control, I decided to bring back the old version that used association lists. To my amazement, it ran 3 times faster, completing in 0.116 seconds! Is my hash table implementaion really that bad, or is this a really poor benchmark (and real-world code actually will be faster using the hash table)?

View 7 Replies


Ubuntu :: Lists Files With Both File Size And MD5 Hash?

Jan 20, 2010

Is there any utility that can provide a list of all files, and both the file size and md5 hash value. Preferably also including other hash values.I've got 1.5 TB of files to go through, and delete duplicates..Neither fdupes or fslint are up to the task --- both claim files to be duplicates, when they definately are not. (Movies, and OOo documents are not identical, even if one is the script for the other, which in this case is not the case. Both fdupes and fslint claimed that those two files were identical. (And yes, I did look at them.

View 5 Replies View Related

Programming :: Custom Delimiter For Hash In Perl?

Jan 6, 2010

Can I have a custom delimiter for hash in perl?

View 4 Replies View Related

Programming :: Get Number Of Elements In A Hash Of Arrays?

Dec 10, 2008

I have something like this:

$arr_hash{'produce'}{'veggies'}[0] = Broccoli
$arr_hash{'produce'}{'veggies'}[1] = Cauliflower
$arr_hash{'produce'}{'veggies'}[2] = Carrots


View 2 Replies View Related

Programming :: Make A Hash Of Objects In Perl?

Aug 31, 2010

I am trying to make a hash of objects in perl (long story.) I have a package containing the main hash and all the subroutines necessary to work with it. My "new" subroutine used to add an object to the hash goes like this:



View 14 Replies View Related

Programming :: Sort Hash Of Hashes By Value In Perl?

Dec 1, 2010

I have a hash of hashes and I need to sort this by value and write to a javascript array file..Currently I am using the following

foreach my $key(sort { keys %{$trans{$a}} <=> keys %{$trans{$b}}} keys %transmission)
foreach my $role(sort {$trans{$key}{$a} cmp $trans{$key}{$b}} keys %{$trans{$key}})


View 2 Replies View Related

Programming :: Store Executable Code In The Value Part Of A Hash?

May 28, 2010

I was reading about Ruby code blocks, but it's all a bit hazy.My questions:1. Can you store executable code in the value part of a hash (err...associative array)2. If you did, how would you call the code?3. If you executed this stored code, would it be possible when doing soto pass in an object to the code that it could use?

View 1 Replies View Related

Programming :: Replace A Hash In A Shadow File Not Using Passwd?

Aug 5, 2010

What is the easiest way to replace a hash in a shadow file for one particular user, not using passwd, and when the current password is unknown?

View 3 Replies View Related

Programming :: Perl - Store And Access An Array In A Hash Of Hashes?

Jul 7, 2010

I am in need of some syntax help. I'm trying to figure out how to store and retrieve an array out of a hash of hashes. For this example, I'm trying to access the city list for a particular state for a particular country. I understand I could do a join and split on the hash key to combine Country and State, but trying to keep things separated.The code I have gets in all the information for the Countries, and states, and gets the list of cities together, no problem. I store all the city names in an array, then make an anonymous pointer to the array for the hash, like this - $MY_CITIES{$COUNTRY}{$STATE} = [@CITIES]I believe that syntax is correct, or is it? What I'd like to do is I need to cycle through every hash to find if a city exists or not. If it exists in 3 states, then it should print 3 times. Here is the code block to search -

for $STATE ( keys %MY_CITIES{$COUNTRY){$STATE} ) {


View 4 Replies View Related

Programming :: MySQL Error When Creating FK In Tables

Dec 11, 2009

Can't single the cause of the error.

mysql> CREATE TABLE Shipment (
-> Shipment_ID INT(10) NOT NULL,
-> Delivery_ID INT(10) NOT NULL,
-> Customer_ID INT(10) NOT NULL,
-> Driver_Employee_ID INT(10) NOT NULL,
-> Consignee VARCHAR(255) NOT NULL,
-> Payment_Method VARCHAR(255) NOT NULL,
-> Payment_Received VARCHAR(1) NOT NULL,
-> FOREIGN KEY (`Delivery_ID`) REFERENCES `Delivery`(`Delivery_ID`)
-> FOREIGN KEY (`Customer_ID`) REFERENCES `Customer`(`Customer_ID`)
-> FOREIGN KEY (`Driver_Employee_ID`) REFERENCES `Driver`(`Driver_Employee_ID`)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FOREIGN KEY (`Delivery_ID`) REFERENCES `Delivery`(`Delivery_ID`)
FOREIGN KEY (`C' at line 10)

View 4 Replies View Related

Programming :: Query To Compare Records Of Two Different Tables?

Dec 31, 2010

i am trying this query to compare records of two different tables...i m geting this message!! no required out putvalues for these ($jobTitle $industry $stationBase $gender $maritalStatus)are coming from textboxes!here is the code...

PHP Code:
$query = "(SELECT *,
MATCH(industry, gender, maritalStatus , typeofWorkPosition , preferCity) AGAINST ('$


View 4 Replies View Related

Programming :: Setup Array To Check Tables?

Nov 9, 2010

I want to specify about 10 tables that should be checked before the application starts, since if they are empty the results are not so good!

Here is what I have so far:

//specify what tables we want to check
$db_array =
//walk the array checking each table for more than 0 records


it's not working,

View 2 Replies View Related

Programming :: Locate The Tables In Versys The House Demographic Information?

Apr 28, 2010

I am trying to locate the tables in Versys the house demographic information, does anyone know the path?

View 1 Replies View Related

Programming :: Match Strings Inside 2 Lists?

Jul 8, 2011

I have that script that checks the nfs mount points:

#set -xv


I am no expert in loops and it took me all day to write that. I couldn't really tell how to match the string in $df_file and $fs_share, so I did a little workaround with a count.

View 9 Replies View Related

Programming :: Script To Exclude Words From A Lists?

Jun 16, 2010

how to delete string inside the file addresses.txt. The string I want to delete on addresses.txt was on removed.txt. I have a file addresses.txt and it includes the ff format:


View 5 Replies View Related

Programming :: Programs Run Faster Than Windows?

Jul 25, 2010

I know this may be just me being a little bias on OS's but... I quite honestly believe that "some" programs run faster on linux than on windows.

Open Office for example, It runs amazingly fast on my linux distro but runs horribly (laggy) on my Vista machine.

Firefox also appears to run faster on my linux machine than on my Vista machine.

There are several more examples but I could go on and on with this.

My point is, do programs run faster on linux than on windows? Or is it just me that is in denial?

I am not sure if comparing linux to Vista is a good comparison in terms of program speed or not...

Also it should be noted that the Vista machine "hardware" is "several" times faster than my linux machine's "hardware".

I am not trying to start a flame war or anything like that, I am just trying to make sure I haven't totally lost my mind.

View 7 Replies View Related

Programming :: Which Is Faster In These Fread() Commands

May 5, 2010

Which is faster:

fread(&buf, 1, 1024, fp);
fread(&buf, 1024, 1, fp);


View 14 Replies View Related

Programming :: Indexing Variables In Lists Using Shell Scripts?

May 27, 2010

I have a question concerning indexing over lists with unix shell scripts. I have very large text files (up to 20 Gb) with the data shown below:



View 14 Replies View Related

Programming :: Sending Mail To Mailing-lists In Perl?

Jan 25, 2011

Im creating a perl script that will be sending out mail to mailing-lists, but im not getting it to work. Its no problem getting the script to send mail to regular mail addresses, but it doesnt seem to handle to send mail to mailing lists. Im using the Net::SMTP perl to send mail from a perl script to a mailing list (and not just regular mail addresses) ?

View 2 Replies View Related

Programming :: Bash - Why Is Process Substitution <() So Much Faster

Nov 25, 2010

file allids consists of 300,000 rows, each containing a 5-7 digit numeric id. file newids consists of 20,000 rows of id's. How do you explain the following timings? time: 0.07s:


diff <(sort allids) <(sort newids)
time: 1.6s:


View 4 Replies View Related

Programming :: Hashing The Components Of An Tcp Session To Assign/locate The Session In A Hash Table Bucket?

Nov 10, 2010

I have a very bad attempt at hashing the components of an tcp session to assign/locate the session in a hash table bucket. I am pretty sure that it has a very high collision rate and when there are a very large number of tcp sessions my application is having to search a long linked list to find the session within the bucket.

All the hashing functions I have found take a single string input where I need to input several integers and hash them into a single result. My guess is that any real hashing function is going to produce better results than what I am currently doing.


View 2 Replies View Related

Programming :: "import By Hash" In Haxxoring Th ELF Format?

Jan 8, 2011

If you can follow this discussion:url

I'd like to know what "import by hash" is.

View 14 Replies View Related

Programming :: 'nm' Lists All Symbols - Including Static Library Symbols?

Apr 5, 2010

By issuing the 'nm' command on shared library (internally using one static library), the functions exposed by static library is also being listed, Which allows to use internal functions which is of course not intended. I have one static library having A(), B() and C() functions. Creating one shared library which has function XYS() that is using A() and B() functions from Static library. While doing 'nm' on shared library, all the static library function are being listed.

Static Lib:

void A(char *msg)


View 4 Replies View Related

Programming :: Matching Two Tables Of Non-matching Sizes?

Mar 2, 2011

I have two table files with x (1st column) ,y (2nd column) coordinates and intensity (3rd column). I need to match these two tables and divide the intensities at the consecutive coordinates on the 3rd column. The problem is the size of the tables are not same and I want to ignore the lines if they are not in one of the other file.

Here is Table 1:


View 3 Replies View Related

General :: Add A Permanent Association To Links?

Feb 23, 2010

I'm using Links on a Ubuntu server, and to view images I'm using Asciiview, which works well, but the association is not retained whenever I close links. How can I retain this association?

View 1 Replies View Related

OpenSUSE :: Thunderbird 3.0.4 - Attachment Association With Applications

Jun 10, 2010

KDE 4.35 Thunderbird 3.0.4. Attached graphic files will only open with Gimp. Preferences allows me to delete an associated application but not to add one.

View 2 Replies View Related

General :: File Association For Desktop Environment

Mar 9, 2011

With a desktop environment, there are file associations that goes with it. I'm a minimalistic user, who doesn't use any of such, but still want some kind of file associations to ease my burden. So I'm searching for a program that does something like the following. open file.pdf this will look at the extension, and translate to okular file.pdf. Of course one can always write a bash script to do this. I wonder if there is something existing, so I don't reinvent the wheel.

View 2 Replies View Related

Ubuntu :: Firefox And Adobe Reader Association

Aug 24, 2010

My firefox will not open a pdf (Adobe reader/acroread) directly. An error comes up that I need to change my preferences. I have gone into preferences, but there is no area for pdf reader in the preferences panel. I have tried reinstalling both acroread, and adobe reader bin file from adobe website, to no avail.

View 3 Replies View Related

Ubuntu :: Txt File Association Fail On Fat32?

Sep 15, 2010

I have a Windows 7 partition, a fat32 partition that I use for moving data between Windows and Linux, and an Ubuntu partition. On the Ubuntu partition, I can right click on a text file and the top of the menu says "open with 'gedit'." On the fat32 partition, the same action says just "open," and the "open with" submenu doesn't include gedit.

If I right-click and choose properties on the same file, the "open with" tab shows gedit as the default file association. So that's weird... anyone else seen anything like this?

View 2 Replies View Related

Ubuntu :: VLC Playlists - Won't Remember File Association

Sep 21, 2010

I am trying to use VLC playlists.

Either xspf or m3u.

Creating them is fine but the only they will launch is if I "Open With" VLC.

Having "Remember this application for "XSPF playlist" files." checked seems to make the assignment b/c when I right-click to get properties VLC is chosen under the "Open With" tab.

The icon doesn't change from the music note image either (I thought I'd get some VLC icon)

I understand this is a bug and you must edit ".local/share/applications/mimeapps.list"

But don't know what to enter there for XSPF or M3U files.

Ubuntu 10.04.1
VLC 1.2.2

View 8 Replies View Related

Copyrights 2005-15, All rights reserved