refactor: remove TypeInfo and StructInfo from StructRef#109
refactor: remove TypeInfo and StructInfo from StructRef#109Wodann merged 3 commits intomun-lang:masterfrom
Conversation
| let runtime_ref = self.runtime.borrow(); | ||
| let type_info = unsafe { &*runtime_ref.gc().ptr_type(self.handle.handle()).inner() }; | ||
| type_info.name() |
There was a problem hiding this comment.
This in particular worries me, because there is a significant performance overhead to retrieving a struct's type information. This change affects StructRef::get, StructRef::replace, and invoke_fn!.
It would already be a lot better if we didn't still have to borrow the Runtime. That means passing the &Runtime as an additional parameter to the ArgumentReflection trait's type_name and type_guid functions, though.
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
+ Coverage 78.25% 78.87% +0.61%
==========================================
Files 141 141
Lines 8949 8724 -225
==========================================
- Hits 7003 6881 -122
+ Misses 1946 1843 -103
Continue to review full report at Codecov.
|
28e2057 to
8a1c25c
Compare
|
@baszalmstra I pushed a fix for the discussion about the runtime overhead of borrowing a |
Instead we collect the most recent TypeInfo pointer from the Runtime's GcRuntime. This allows us to maintain the StructRef even after hot reloads
This prevents duplicate storage as the struct's name is already stored in the TypeInfo
8a1c25c to
69ee4e2
Compare
Instead we collect the most recent
TypeInfopointer from theRuntime'sGcRuntime. This allows us to maintain theStructRefeven after hotreloads.