Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-09-2004, 05:49 PM
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: United Kingdom
Posts: 1,877
TrafficProducer RepRank 1
Default Faster data access code

Faster data access code

I am using PERL to search through a number of files.

These files are combined into a large, (25Mb or more) normal array which is parsed and searched on.

Here is the outline of the pseudocode used:-

Open INFILE
@data_1 = <INFILE>;
close INFILE

open INFILE..
@data_2 = <INFILE>;
close INFILE

@all_filed_bargain_data=
(
@data_1,
@data_2
);

Then

While(not eof)
{
Parse the data from each array element number to get string_to_look_in

look for each Keyword in the string_to_look_in using:-
if(lc($string_to_look_in) =~ m/\b$search_keyword\b/gi) # Any case Whole word found
{
$keyword_found=$TRUE;
}
}

This works quite well but I whish to improve the speed of the searching, it takes about 4 to 6 seconds to return the results using the code above.

Questions, which would be faster

a) MySQL
b) C or C++
c) Other language
d) Stay with PERL but use Hash associated arrays instead of plain arrays as used now.
e) Use perl-mod
f) An other ideas

Wesite in question:-
http://www.comparebargains.com

Thank you.
__________________
Videos to Watch and Video Publishing
Affiliate Program! Our Affiliate Program Pays 50.00% Business Support
Reply With Quote
  #2 (permalink)  
Old 08-09-2004, 07:23 PM
redcircle's Avatar
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 553
redcircle RepRank 0
Default

you could use grep and inject it into perl and manage the data from there.
__________________
www.squitosoft.com - PHP development site. featuring Squito Gallery. a php driven photo gallery.
www.rgfx.net - Specializing in Internet solutions, including Html authoring, Interactive Web sites, 3D/2D Graphics and animation.
Reply With Quote
  #3 (permalink)  
Old 08-20-2004, 10:33 AM
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: United Kingdom
Posts: 1,877
TrafficProducer RepRank 1
Default Grep is better... Thankyou

Quote:
use grep and inject it into perl and manage the data from there.
OK, this is has been done.

I think this is better because I now do AND searches..

As for speed, I think this is about it works out about the same after the AND'ing of search words so I'm still looking for a speed boost.

Thank you for the Grep idea this has improved things.

ref: http://www.comparebargains.com
__________________
Videos to Watch and Video Publishing
Affiliate Program! Our Affiliate Program Pays 50.00% Business Support
Reply With Quote
  #4 (permalink)  
Old 08-22-2004, 02:09 PM
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: United Kingdom
Posts: 1,877
TrafficProducer RepRank 1
Default Speed now improved Thanks to Grep

Speed now improved Thanks to Grep..

Another update.

By directly feeding the results of one Grep into another Grep to carry out the ANDing speed has been improved.

Thank you for the Grep idea.
__________________
Videos to Watch and Video Publishing
Affiliate Program! Our Affiliate Program Pays 50.00% Business Support
Reply With Quote
  #5 (permalink)  
Old 08-22-2004, 03:47 PM
mushroom's Avatar
WebProWorld Veteran
 

Join Date: Feb 2004
Location: Queen Charlotte B. C. Canada
Posts: 351
mushroom RepRank 0
Default

I beleave the MySql is the best solution, provided that your tables are built with your querys in mind. Speeds of a fraction of a second are common even with large data bases and complex querys, if the tables are optemized for the querys.
__________________
Irony: That for most people the most "trusted" web site on the planet is for a company the has been convicted of criminal activity.

Both Security and SuSe start with "S". www.oldslides.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0