Page 1 of 1

Is there a more efficient way for this program?

Posted: Tue Sep 16, 2008 4:38 am
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?

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

Posted: Tue Sep 16, 2008 4:42 am
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.