[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] array->hash (was: Love & Hate shenanigans)



>>>>> "RH" == Robin Houston <robin@kitsite.com> writes:

  >> Also interesting: Converting the large array to a hash is very slow with
  >> map and fast with foreach:

  RH> According to my benchmark (attached), it's slightly quicker to do

  RH> @Array{@Array} = (1)x@Array;

  RH> which is a beautiful trick :-)

	@Array{@Array} = () ;

is even faster i believe. if all you are going to do is text with exists
this works well. check out my hash slice tutorial which has many tricks
like this.

http://tlc.perlarchive.com/articles/perl/ug0001.shtml

slices are an underutilized perl feature IMO.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe