T
* Tong *
Hi,
Consider the following data structure, what's more efficient, hash or array?
$precord{name},
$precord{age},
$precord{birthday},
I used to used this form. It is clearer. Then one day I thought
that using hash should be expensive than using the direct-access
array. So I change the above hash into array:
$precord[$NDX_NAME],
$precord[$NDX_AGE],
$precord[$NDX_BIRTHDAY],
But just recently I read somewhere that hash is more efficient
that array.
So, I am really curious to know what's more efficient in the above
two approaches, and how much better one over the other. Thanks.
Consider the following data structure, what's more efficient, hash or array?
$precord{name},
$precord{age},
$precord{birthday},
I used to used this form. It is clearer. Then one day I thought
that using hash should be expensive than using the direct-access
array. So I change the above hash into array:
$precord[$NDX_NAME],
$precord[$NDX_AGE],
$precord[$NDX_BIRTHDAY],
But just recently I read somewhere that hash is more efficient
that array.
So, I am really curious to know what's more efficient in the above
two approaches, and how much better one over the other. Thanks.