Re: Can we start using C++ STL containers in Mozilla code?

2015-04-22 Thread pww19710430
在 2013年12月10日星期二 UTC+8下午5:28:21,Chris Pearce写道: Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents, and more familiar to new contributors. I understand

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-13 Thread Georg Fritzsche
On 12/10/2013 16:17, Joshua Cranmer  wrote: I think the right answer is to make the myriad of datatypes we have more STL-ish--as a first step at least, can we at least add iterator support for them and get rid of the abominable EnumerateForwards/EnumerateBackewards methods? This would allow us

Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Chris Pearce
Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents, and more familiar to new contributors. I understand that we used to have a policy of not using STL in mozilla

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Benoit Jacob
Note that we already do use at least those STL containers for which we don't have an equivalent in the tree. I've seen usage of at least: std::map, std::set, and std::bitset. I think that Nick has a good point about reporting memory usage, but I think that the right solution to this problem is to

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Benoit Jacob
Also note that IIUC, the only thing that prevents us from solving the memory-reporting problem using a STL allocator, is that the spec doesn't allow us to rely on storing per-object member data on a STL allocator. Even without that, we could at least have a STL allocator doing

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread smaug
On 12/10/2013 11:28 AM, Chris Pearce wrote: Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents, and more familiar to new contributors. I understand that we used to

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Boris Zbarsky
On 12/10/13 9:49 AM, Benoit Jacob wrote: since AFAIK we don't have a HashSet class in mfbt or xpcom. It's called nsBaseHashtable. Granted, using it as a hashset is not that intuitive. -Boris ___ dev-platform mailing list

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Kyle Huey
On Tue, Dec 10, 2013 at 1:28 AM, Chris Pearce cpea...@mozilla.com wrote: Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents, and more familiar to new

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Jason Orendorff
On 12/10/13 9:09 AM, Boris Zbarsky wrote: On 12/10/13 9:49 AM, Benoit Jacob wrote: since AFAIK we don't have a HashSet class in mfbt or xpcom. It's called nsBaseHashtable. Granted, using it as a hashset is not that intuitive. There's also js::HashSet in js/public/HashTable.h. -j

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Joshua Cranmer 
On 12/10/2013 3:28 AM, Chris Pearce wrote: Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents, and more familiar to new contributors. I understand that we used

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Benjamin Smedberg
On 12/10/2013 9:49 AM, Benoit Jacob wrote: std::set compared to using a hashtable to do the same thing, since AFAIK we don't have a HashSet class in mfbt or xpcom. nsTHashtableKeyType is the XPCOM hashset. --BDS ___ dev-platform mailing list

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Benjamin Smedberg
On 12/10/2013 4:28 AM, Chris Pearce wrote: Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents, and more familiar to new contributors. njn already mentioned the

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Josh Matthews
On 12/10/2013 09:49 AM, Benoit Jacob wrote: std::map and std::set are also free of any size restriction, and do not require a contiguous part of our address space (see https://bugzilla.mozilla.org/show_bug.cgi?id=944810#c12 ) , so they won't run OOM before we are actually OOM. I posit that if

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Chris Pearce
It seems to me that we should be optimizing for developer productivity first, and use profiling tools to find code that needs to be optimized. i.e. we should be able to use STL containers where we need basic ADTs in day-to-day coding, and if instances of these containers show up in profiles

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Robert O'Callahan
On Wed, Dec 11, 2013 at 10:29 AM, Chris Pearce cpea...@mozilla.com wrote: It seems to me that we should be optimizing for developer productivity first, and use profiling tools to find code that needs to be optimized. i.e. we should be able to use STL containers where we need basic ADTs in

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Benoit Jacob
2013/12/10 Chris Pearce cpea...@mozilla.com It seems to me that we should be optimizing for developer productivity first, and use profiling tools to find code that needs to be optimized. i.e. we should be able to use STL containers where we need basic ADTs in day-to-day coding, and if

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Botond Ballo
Also note that IIUC, the only thing that prevents us from solving the memory-reporting problem using a STL allocator, is that the spec doesn't allow us to rely on storing per-object member data on a STL allocator. I believe C++11 supports this. Cheers, Botond

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Mike Hommey
On Tue, Dec 10, 2013 at 09:17:22AM -0600, Joshua Cranmer ? wrote: On 12/10/2013 3:28 AM, Chris Pearce wrote: Hi All, Can we start using C++ STL containers like std::set, std::map, std::queue in Mozilla code please? Many of the STL containers are more convenient to use than our equivalents,

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Robert O'Callahan
On Wed, Dec 11, 2013 at 10:50 AM, Benoit Jacob jacob.benoi...@gmail.comwrote: 2013/12/10 Robert O'Callahan rob...@ocallahan.org Keep in mind that proliferation of different types for the same functionality hurts developer productivity in various ways, especially when they have quite

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Joshua Cranmer 
On 12/10/2013 3:29 PM, Chris Pearce wrote: It seems to me that we should be optimizing for developer productivity first, and use profiling tools to find code that needs to be optimized. For many of our developers, the STL is not an API that they are intimately familiar with, so it's not

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Jeff Gilbert
- Original Message - From: Robert O'Callahan rob...@ocallahan.org To: Benoit Jacob jacob.benoi...@gmail.com Cc: Chris Pearce cpea...@mozilla.com, dev-platform dev-platform@lists.mozilla.org Sent: Tuesday, December 10, 2013 2:04:06 PM Subject: Re: Can we start using C++ STL containers in Mozilla

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Botond Ballo
For many of our developers, the STL is not an API that they are intimately familiar with, so it's not altogether clear that using the STL instead optimizes for developer productivity. Developers come and go, however, and the average C++ developer is more likely to be familiar with STL

Re: Can we start using C++ STL containers in Mozilla code?

2013-12-10 Thread Nicholas Nethercote
[I'm highlighting this exchange, because it's been buried somewhat; apologies for the misleading information] On Tue, Dec 10, 2013 at 4:29 PM, Joshua Cranmer  pidgeo...@gmail.com wrote: Based on