freeloader Posted February 11, 2007 Share Posted February 11, 2007 Hi guys, I have a code that gets connects with a webserver through cURL, and retrieves a page with a table. I need only 2 columns, but i need them linked together. I use a global var for that and store it as $globalvar[element1] = 'element2'; the way I go through the result of the webpage is with preg_match_all. Is preg_match_all the fastest solution in this case? Sometimes it needs to do over 1000 pages in a row so i'm really looking for the fastest way here Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/37968-code-optimization/ Share on other sites More sharing options...
freeloader Posted February 12, 2007 Author Share Posted February 12, 2007 This question is not going to get answered on page 50 Bump. Link to comment https://forums.phpfreaks.com/topic/37968-code-optimization/#findComment-182330 Share on other sites More sharing options...
ToonMariner Posted February 12, 2007 Share Posted February 12, 2007 I am not quite getting what you are asking... Are just retrieing the source html from a file and parsing it? or is this curl request returning query results from another database table... Could just be me but I don't think your question is very well explained. Link to comment https://forums.phpfreaks.com/topic/37968-code-optimization/#findComment-182335 Share on other sites More sharing options...
btherl Posted February 12, 2007 Share Posted February 12, 2007 I doubt you'll get faster than a regular expression. Parsing the document will take much longer. And ereg is slower than preg, so you've made the right choice there The only way I can imagine you might do it faster would be by making an educated guess and truncating the document before you do the matching. You may be able to safely remove some data from the front and end. As always, benchmark any change to see if you actually made it slower by trying to be too smart Link to comment https://forums.phpfreaks.com/topic/37968-code-optimization/#findComment-182338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.