Vladimir Lipskiy wrote:

The current implementation of find_lex (by_name) is suboptimal. A linear
scan over the list of lexical names is performed
(s. sub.c:lexicals_get_position()).

A better way would be to provide a list of lexicals plus a name hash,
where hash values are indices into the list.


What would be a better way depends on a number of elements on a list.
If the number is small I don't think that a hash search + an access of a
list element will beat a list scanning. And if each lexical scope has its
own list (doesn't it?) a usual number of elements on a list won't exceed
10-20,

I did compare the linear lexical search with a hash access now:
Locating the first lexical is already slower then a hash access. Getting the 10th lexical is 4 times slower.store_lex takes double the time of hash_put.


leo



Reply via email to