Jesus Christ - Yes thats the only word I have for Perl. Today I have released how speedy, stable and simple Perl is.
Now the reason why I am saying this is because of the same thread I opened at Perlmonks - http://perlmonks.org/?node_id=818166 Just refer the code shared by rkrieger. That algorithm made the searching process freakingly fast. It was able to process 4,00,000 absolutely random elements in 2 seconds. Thats astonishing. Sorting algorithm couldn't help much as it took more than 20 minutes and I had to finally exit the script execution before the system began to crawl. Anyways Thanks to all for sharing your suggestions and helping me understand sorting concepts. Special thanks to Larry and his team and all opensource developers for making Perl such a beautiful language to work on. BTW what makes Perl and Hashes so fast? Cheers, Parag On Tue, Jan 19, 2010 at 9:50 PM, Shawn H Corey <shawnhco...@gmail.com>wrote: > Parag Kalra wrote: > > Hello All, > > > > I have 2 arrays. I have written a script that searches each and every > value > > of first array in the second array. Each & every value of Source Array > > should occur only once in the target array but it can occur anywhere. > > > > If any of the source value doesn't occur or occur multiple times then the > > script reports to the user. > > > > This script is working fine for small arrays. > > > > But I tried executing the script for 2 arrays each of which containing > > around 7,00,0000 elements and it is taking very long time. > > I am using nested 'for' loops to make this search. How can I optimize it > > further to search source array in target array. > > > > Cheers, > > Parag > > > > Sort both arrays. For each item in the first array, step through the > second until it is found, you encounter a value greater than it, or you > reach the end of the array. > > > -- > Just my 0.00000002 million dollars worth, > Shawn > > Programming is as much about organization and communication > as it is about coding. > > I like Perl; it's the only language where you can bless your > thingy. >