>
> Performance penalty is insignificant here: the following test on my machine
> emits the following results:
> 1000000 (1e6) iterations
> dict:
> 2.491708
> 4.262242
> 6.753950
> dictdot:
> 2.194558
> 3.899753
> 6.094311
> var:
> 2.179728
> 3.792891
> 5.972619
> It is about 10% penalty when using [] syntax and only 2% when using dot syntax:
> It looks like vim is using the same hash function for both for dictionary and
> variable lookup. Here is a table created by
ZyX -- Thanks for that, definitely looks usable for me. Will migrate
to that setup, probably in steps.
I have another performance-related (but unrelated to the clean-coding-
practice issue) question about dicts that I've been wondering about.
Does the length of the name assigned to a key affect memory usage?
For example, in comparing the two dictionaries below, both of which
have 1,000,000 entries, does the long name of the key affect memory
usage?
{ 'entry_1': { 's1': 'text_for_s1'}, . . . 'entry_1000000': { 's1':
'text_for_s1'} }
{ 'entry_1': { '____________________________________s1':
'text_for_s1'}, . . . 'entry_1000000':
{ '_______________________________s1': 'text_for_s1'} }
I guess I could just do the test myself, and I guess I will now, but
if you know off the top of your head I'd be curious to hear more about
these internal storage details for dicts.
-- Herb
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment