Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #6124
| From | William Gill <noreply@domain.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | in_array performance in unsorted vs sorted array |
| Date | 2012-05-23 02:20 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <jphvj0$acu$1@dont-email.me> (permalink) |
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?
Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread
in_array performance in unsorted vs sorted array William Gill <noreply@domain.invalid> - 2012-05-23 02:20 -0400
Re: in_array performance in unsorted vs sorted array Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-23 08:16 -0400
Re: in_array performance in unsorted vs sorted array William Gill <noreply@domain.invalid> - 2012-05-23 10:57 -0400
Re: in_array performance in unsorted vs sorted array William Gill <noreply@domain.invalid> - 2012-05-23 11:01 -0400
Re: in_array performance in unsorted vs sorted array Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2012-05-24 22:20 +0200
Re: in_array performance in unsorted vs sorted array Captain Paralytic <paul_lautman@yahoo.com> - 2012-05-23 02:36 -0700
csiph-web