Is there a more efficient way for this program?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tunyawat
Forum Newbie
Posts: 3
Joined: Fri Sep 05, 2008 2:09 am

Is there a more efficient way for this program?

Post by tunyawat »

There is a function for message processing in my program. This function read thousand lines of strings from a text file to create an array ($dictionary). The function uses the $dictionary to detect and process the words in a message.

This function is called every time when a user send a message to the server. Each user need to send around 20-100 messages per session (similar to chatting). I don't want the $dictionary to be created each time when a message is received. Is there a more efficient way for doing this?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Is there a more efficient way for this program?

Post by onion2k »

Well, for a start, by the sounds of things it'd be more efficient to put the dictionary into a database table and then build an array of the words in the message rather than everything.
Post Reply