On Fri, Nov 1, 2013 at 7:31 AM, John Peterson <jwpeter...@gmail.com> wrote:

>
>
> > On Nov 1, 2013, at 5:56 AM, Roy Stogner <royst...@ices.utexas.edu>
> wrote:
> >
> >
> >> On Thu, 31 Oct 2013, John Peterson wrote:
> >>
> >>      We build a std::map<> from Elem* to a unique sorted contiguous ID,
> as Metis only considers the active elements and needs
> >>      some contiguous numbering. I expect that gets quite big, and maybe
> should be refactored to use a sorted
> >>      std::vector<std::pair<Elem*, dof_id_type> > instead?
> >> You are quite correct about this.  I ran our memory logger to compare
> the size of memory of a map<int,int> and a vector of
> >> pair<int,int>, both with 8M elements.  The results were pretty striking:
> >>
> https://drive.google.com/file/d/0B9BK7pg8se_iaWFzbHlEemxmX0U/edit?usp=sharing
> >> The map's peak memory usage is almost exactly 6X that of the vector's...
> >
> > Wow, nasty.  I was expecting 3X; I forgot about the sizeof(int*) ==
> > 2*sizeof(int) issue.
> >
> > It's not really relevant here, but out of curiosity, could you give
> > unordered_map a try?
>
> Sure, I had a plot with several different containers, but I forgot about
> the unordered ones.  I'll make one later today.


unordered_map ends up somewhere between vector<pair> and map in terms of
memory usage.

https://drive.google.com/file/d/0B9BK7pg8se_iTFBBSTZzSm8xSTA/edit?usp=sharing


This is an interesting article on different implementations of the
unordered containers:

http://bannalia.blogspot.com/2013/10/implementation-of-c-unordered.html

Looks like the three main ones are doubly-linked list between all values,
or storing the hashes, to satisfy the complexity requirements for iterating
over the data...

-- 
John
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to