roxen.lists.pike.general

Subject Author Date
RE: Arrays, multisets, mappings: avoiding unnecessary memory (re)assigns Arjan van Staalduijnen <Arjan[dot]van[dot]Staalduijnen[at]rtl[dot]nl> 09-09-2009
> In some if-statements I rewrote some or-statements to something like:
>	if ( (< "a", "b", "c" >)[ val ] ) {}
> instead of:
>	if ( val == "a" || val == "b" || val == "c" ) {}
> because, apart from being shorter, I assumed it would be more efficient.
> Wrong again, or is the multiset way the most-efficient way here?

....or maybe rewrite it to:
	if ( ([ "a":1,"b":1,"c":1 ])[ val ] ) {}

Regards,

Arjan