| View previous topic :: View next topic |
| Author |
Message |
GregLand Valued Contributor


Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Sun Mar 29, 2009 11:08 am Post subject: |
|
|
I think so it's more relivable with the first 500 or 1000 characters.
Thanks for all ! |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Mar 30, 2009 7:01 pm Post subject: |
|
|
| Dr. Dread wrote: | Dan's code should be quite reliable. But I'm also pretty sure that with VDS this kind of looping
would be sloooow if the file isn't small.
With binary files it would be OK, because the loop will probably find a binary-flagged char quite
soon and exit the loop. But with ASCII files you will loop through the entire file and that means
more than a million loops just for a 1MB file.
So I would suggest that you just do the check for perhaps the first 1000 chars only. Count the loops
and exit if you go beyond that count.
Greetz
Dr. Dread |
Hmm IMHO if your breaking out of the loop as soon as you find your first binary byte then I don't think it is going to be that slow. Most so called binary files usually don't have that many printable characters before a non-printable character is found. Also by using the BINFILE or the @NEW() you are not loading the whole file into memory since these use file streams. The only thing that I would do is nest Dan's code inside of code to check the file's extension. If the file does not have an extension that you reconize as a flatfile then do the brute force search of all the bytes in the file. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Tue Mar 31, 2009 6:22 am Post subject: |
|
|
| dragonsphere wrote: |
Hmm IMHO if your breaking out of the loop as soon as you find your first binary byte then I don't think it is going to be that slow. |
As I already stated binary files would be OK, but with ASCII files the script will loop through the entire file,
and looping through for instance a 1MB file while calling a number of functions in each loop - that will be a
drag for sure.
Greetz
Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
|