in_array performance in unsorted vs sorted array
- From: William Gill <noreply@xxxxxxxxxxxxxx>
- Date: Wed, 23 May 2012 02:20:19 -0400
I am reading transaction records from files. Each record has an alphanumeric GUID but that record may be repeated in more than one file (because of overlapping samples). I don't want to process duplicate records, so I am considering a simple flat file to store the GUID's of previously processed records.
To keep things simple I plan to use $done=file() to read the flat file, and a simple if in_array to see if the current GUID has already been processed, if not process the current record and add its GUID to $done.
Does anyone know if sorting an array has any significant impact on in_array, or can I simply push push values into $done?
Also is there a better way than foreach() write() to get $done back into the flat file?
.
- Follow-Ups:
- Re: in_array performance in unsorted vs sorted array
- From: Jerry Stuckle
- Re: in_array performance in unsorted vs sorted array
- From: Captain Paralytic
- Re: in_array performance in unsorted vs sorted array
- Prev by Date: Re: PHP Concatenate
- Next by Date: Re: in_array performance in unsorted vs sorted array
- Previous by thread: array_walk always passing 0 as the parameter
- Next by thread: Re: in_array performance in unsorted vs sorted array
- Index(es):
Relevant Pages
|