Dominique Pelle wrote:

> Hi
> 
> Using the heap profiler 'valgrind --tool=massif vim'
> I saw 135,536 bytes allocated from here:
> 
> | | ->03.74% (135,536B) 0x43D7D1: dict_alloc (eval.c:6977)
> | | | ->03.69% (133,816B) 0x43E360: get_dict_tv (eval.c:7471)
> | | | | ->03.69% (133,816B) 0x43A8AD: eval7 (eval.c:5081)
> | | | |   ->03.69% (133,816B) 0x43A34C: eval6 (eval.c:4802)
> | | | |     ->03.69% (133,816B) 0x439E9C: eval5 (eval.c:4618)
> 
> eval.c:
> 
> 6977     d = (dict_T *)alloc(sizeof(dict_T));
> 
> Adding printf(), I see that sizeof(dict_T) is 344 bytes
> on Linux x86_64. Attached patch reorders fields in
> that struct to reduce padding and brings sizeof(dict_T)
> to 336 bytes. It thus saves :
> 
> 135536 - 135536/344*336 = 3152 bytes
> 
> It's not much but it's simple and several of such other
> changes can add up.

Yeah, that's not much.  It might help more to postpone allocating a dict
until it's needed.

-- 
hundred-and-one symptoms of being an internet addict:
162. You go outside and look for a brightness knob to turn down the sun.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui