D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6103 - hasFinalizer field in ClassInfo
Summary: hasFinalizer field in ClassInfo
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2011-06-04 09:55 UTC by David Simcha
Modified: 2011-12-28 06:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011-06-04 09:55:52 UTC
ClassInfo needs a hasFinalizer field that is true iff the class or its ancestor has a non-empty finalizer.  This way, instead of conservatively flagging all GC-allocated objects with GC.BlkAttr.FINALIZE, only those that need to be finalized could be flagged.  On this benchmark (https://github.com/dsimcha/druntime/blob/master/gcBench/tree1.d) avoiding calling empty finalizers results in about a 20% speedup.
Comment 1 David Simcha 2011-12-28 06:51:42 UTC
I'm marking this invalid even though it could be implemented because I realized it won't be useful.  rt_finalize needs to be called to finalize the monitor object if one exists, even if the class has no explicit finalizer.