1

Which operation is fastest and creating less loading, LR web_reg_find() or C strstr()? Which is more preferable for a very strong loading test?

And if somebody knows how web_reg_find() works, please tell me.

Lundin
  • 195,001
  • 40
  • 254
  • 396
XanderR
  • 31
  • 3
  • 1
    You can't replace web_reg_find() with strstr() so you can't compare their performance (web_reg_find() will almost always appear to be faster because it does the search while loading). – Adriano Repetti Oct 25 '12 at 07:49
  • 1
    To read as: **raw** performance of web_reg_find() is worse than strstr(), it offers many features you don't have with strstr() but it may appear faster because it can work during page download. Simply you can't compare them. – Adriano Repetti Oct 25 '12 at 07:51

1 Answers1

0

With strstr you would have to pull each and every component on a page and search after the download explicitly against a string in a buffer. With web_reg_find() you are setting a filtering condition through which every response component on a page passes.

If you choose the strstr() route you will still have to download the page components and then run the check against each component. You will use more memory and unless you are very good at your memory management you will likely miss a free() on occasion and introduce a memory leak condition, which is you are pressed for time to get a script out the door becomes a common side effect. With the web_reg_find() you can have it oppewrating concurrent to the page download with no slowdown on the page download itself.

I am not sure where Adriano has the research on raw performance of one versus the other since the operations of the two are so different as a web_reg_find() would be complete before a strstr() could even be initiated - I have to download and populate a buffer to search before I can search it.

James Pulley
  • 5,606
  • 1
  • 14
  • 14