Closed Bug 1351804 Opened 9 years ago Closed 9 years ago

Switch libpref over to ArenaAllocator

Categories

(Core :: Preferences: Backend, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: erahm, Assigned: erahm)

References

Details

Attachments

(1 file)

MozReview-Commit-ID: 4GovbBFUBb9
Attachment #8852619 - Flags: review?(nfroyd)
Comment on attachment 8852619 [details] [diff] [review] Switch libpref over to ArenaAllocator Review of attachment 8852619 [details] [diff] [review]: ----------------------------------------------------------------- ::: modules/libpref/prefapi.cpp @@ +66,5 @@ > return (strcmp(prefEntry->key, otherKey) == 0); > } > > PLDHashTable* gHashTable; > +static ArenaAllocator<8192,4> gPrefNameArena; I'm not super-excited about the static constructor this is going to add. Maybe we can make the ArenaAllocator constructor constexpr to avoid that? Or, alternatively, we could have: struct GlobalPrefState { // Add the obvious constructor, etc. PLDHashTable mHashTable; ArenaAllocator<...> mPrefNameArena; }; static GlobalPrefState* gState; and use that everywhere?
Attachment #8852619 - Flags: review?(nfroyd) → review+
(In reply to Nathan Froyd [:froydnj] from comment #2) > Comment on attachment 8852619 [details] [diff] [review] > Switch libpref over to ArenaAllocator > > Review of attachment 8852619 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: modules/libpref/prefapi.cpp > @@ +66,5 @@ > > return (strcmp(prefEntry->key, otherKey) == 0); > > } > > > > PLDHashTable* gHashTable; > > +static ArenaAllocator<8192,4> gPrefNameArena; > > I'm not super-excited about the static constructor this is going to add. > Maybe we can make the ArenaAllocator constructor constexpr to avoid that? I'll make it constexpr in the blocking bug. > Or, alternatively, we could have: > > struct GlobalPrefState > { > // Add the obvious constructor, etc. > PLDHashTable mHashTable; > ArenaAllocator<...> mPrefNameArena; > }; > > static GlobalPrefState* gState; > > and use that everywhere? That sounds like more hassle than it's worth :)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: