FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » in_array performance in unsorted vs sorted array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: in_array performance in unsorted vs sorted array [message #178237 is a reply to message #178204] Wed, 23 May 2012 09:36 Go to previous message
Captain Paralytic is currently offline  Captain Paralytic
Messages: 204
Registered: September 2010
Karma:
Senior Member
On May 23, 7:20 am, William Gill <nore...@domain.invalid> wrote:
> 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?

Why not load the files into a database table which has a primary key
of the GUID, then you have one record for each GUID
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Windows binaries 64bit for PHP
Next Topic: On the usage of "@" (error control operator)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Oct 02 00:24:10 GMT 2024

Total time taken to generate the page: 0.04123 seconds