Closed Bug 1525953 Opened 5 years ago Closed 2 years ago

make log module creation better

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: froydnj, Unassigned)

References

Details

Attachments

(5 files)

This doesn't improve actually fetching already-created log modules, but it will
make their point of creation slightly faster and eliminates a little bit of
process memory to boot.

They are already, and ensuring this means that we can remove some
allocations in later patches.
Attachment #9042171 - Flags: review?(erahm)
Now that log module names are guaranteed to be in static storage, we can
depend on them directly, rather than allocating storage for them in the
hash table.
Attachment #9042172 - Flags: review?(erahm)
The module name comes via LazyLogModule, which is guaranteed to have
statically-allocated names, so there's no reason we have to strdup here.
Attachment #9042173 - Flags: review?(erahm)
This is partially a workaround for C++'s visibility rules, but it might
also make a difference if constructor arguments are particularly
expensive to construct.  Having a lambda means that the evaluation of
those arguments can be delayed until necessary, unlike LookupOrAdd.
Attachment #9042174 - Flags: review?(erahm)
No reason to do the hash lookup twice here.
Attachment #9042175 - Flags: review?(erahm)
Comment on attachment 9042172 [details] [diff] [review]
part 2 - don't duplicate strings in LogModuleManager's hash table

Ugh, we can't do this because you can pass in dynamic module names via preferences and such.
Attachment #9042172 - Flags: review?(erahm)
Comment on attachment 9042173 [details] [diff] [review]
part 3 - don't duplicate strings in LogModule

Same problem as with part 2, though maybe you could get this to be tied to the lifetime of the hash key, and reuse the same thing for both?
Comment on attachment 9042171 [details] [diff] [review]
part 1 - enforce that LazyLogModule names are compile-time constants

Clearing reviews for now, I don't think this is ready yet. Let me know if you want me to review other parts.
Attachment #9042171 - Flags: review?(erahm)
Attachment #9042173 - Flags: review?(erahm)
Attachment #9042174 - Flags: review?(erahm)
Attachment #9042175 - Flags: review?(erahm)

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: froydnj+bz → nobody

The main change in this bug happened as one of the bulk changes in bug 1691894, so we can resolve this.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
See Also: → 1691894
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: