Re: RFC 163 (v2) Objects: Autoaccessors for object data structures
[email protected] (Michael G Schwern) Mon, 18 Sep 2000 16:06:39 -0400
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Sep 18, 2000 at 01:02:31PM -0700, Glenn Linderman wrote: > OK, thanks for the info. I'm not an internals guy, but I guess I > should have written the benchmark. It just _seemed_ they should be > slower, because there is more work to do the hashing. The actual > lookup, I agree, should be the same. Similar mistaken logic leads to "globals are faster than lexicals". > Now while it is _totally_ true from your numbers that the lookup > (read reference) costs are the same, it would seem that the > variability in write references could still make this pay off. The > set_const is about 40% slower for hash, and set_var is about 166% > slower. Accessor overhead swamps all. > N.B. I wonder if the hash accessor is faster because the array > accessor is referencing past the end of the array? (not apples to > apples here, you use index 0 everywhere else, and index 1 in the > accessor.) Its just benchmarking flutter. I reran it with 1 everywhere else and the same results. Besides, because $aobj is global, the first call would extend the array and the following 899_999 wouldn't worrry about it. > > I know, lets call it a pseudo-hash! > > > > Been there, done that, worn the scars proudly. > > Is _that_ what a pseudo-hash is? Then it sounds like a good idea. > But maybe there are some differences between today's pseudo-hash and > my proposal, even though they might be similar. I think mine is > pretty general, and the discussion on this list made it sound like > pseudo-hash has some other restrictions? Read RFC 241 for a brief overview of pseudo-hash problems. -- Michael G Schwern http://www.pobox.com/~schwern/ [email protected] Just Another Stupid Consultant Perl6 Kwalitee Ashuranse Sometimes these hairstyles are exaggerated beyond the laws of physics - Unknown narrator speaking about Anime