TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-04-2009, 05:24 PM   #21 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

The value 11695 isn't the number of matches persay. It's the number of rows that the script had to search through until reaching the row (row #11696) which contains only "1644592". This is not a viable test of the script since the file is generated randomly and the speed of execution relies on the position of the matching line (if at all) in the file.

With the results shown above by Sakakuchi, it shows that 11696 lines were examined in 124ms (each line took approx 0.01ms). The loop stops when the line is found because the fscanf call returns NULL (if 1644592 is the entire line, it can't pull back any string value which you asked for in the formatting string). This, as far as I understand, is a misuse of fscanf.

My own fluffing of the test so that a match is made on line 11696 produced a result of 22.1ms (0.002ms per line). These results cannot be relied on for anything useful (except perhaps the per-line execution speed) because they only look through 1.17% of the file! Try looking for "1644592blahblahblah%s\n" instead of "1644592%s\n" and paste those results since that will force the script to look through the entire file (and fail to find a match).

Last edited by Salathe : 03-04-2009 at 06:15 PM. Reason: typoes
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
ETbyrne (03-04-2009)
Old 03-04-2009, 05:46 PM   #22 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

Very insightful Salathe, I'll try out what you suggested.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Old 03-04-2009, 06:25 PM   #23 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
The value 11695 isn't the number of matches persay. It's the number of rows that the script had to search through until reaching the row (row #11696) which contains only "1644592". This is not a viable test of the script since the file is generated randomly and the speed of execution relies on the position of the matching line (if at all) in the file.

With the results shown above by Sakakuchi, it shows that 11696 lines were examined in 124ms (each line took approx 0.01ms). The loop stops when the line is found because the fscanf call returns NULL (if 1644592 is the entire line, it can't pull back any string value which you asked for in the formatting string). This, as far as I understand, is a misuse of fscanf.

My own fluffing of the test so that a match is made on line 11696 produced a result of 22.1ms (0.002ms per line). These results cannot be relied on for anything useful (except perhaps the per-line execution speed) because they only look through 1.17% of the file! Try looking for "1644592blahblahblah%s\n" instead of "1644592%s\n" and paste those results since that will force the script to look through the entire file (and fail to find a match).

HAHAHA you're crazy!! You know TOO MUCH!!!
allworknoplay is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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


All times are GMT. The time now is 09:28 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design