Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

hash access

1 view
Skip to first unread message

Leopold Toetsch

unread,
Aug 20, 2003, 1:49:09 PM8/20/03
to P6I
We have keyed_int shortcuts to get/set items on array like aggregates.
Is there a reason, that we not have keyed_str to access hash elements by
STRING directly.
Currently a hash access inside parrot needs a key_new_string() which
contructs a new Key PMC, where the string then gets extracted again.

This would add ~15 vtable entries: {get,set}_<type>_keyed_str, type,
exists, defined, delete. Ah yes, and some ops variations ;-)

Comments welcome
leo

Sean O'Rourke

unread,
Aug 20, 2003, 6:38:15 PM8/20/03
to Leopold Toetsch, P6I
Leopold Toetsch <l.to...@nextra.at> writes:

> We have keyed_int shortcuts to get/set items on array like aggregates.
> Is there a reason, that we not have keyed_str to access hash elements
> by STRING directly.

I'm not so sure this would be worth it; since hash lookups are much
more expensive than array indexing, the gain from avoiding a
wrap/unwrap won't be nearly as significant. Of course the only way
to tell would be to do some benchmarks, but it seems to me like ops
and optimization time could better be spent elsewhere.

/s

0 new messages