Skip to content

Commit c5f033f

Browse files
committed
Runtime logs computing class method dispatch and destructor dispatch at verbosity level 1.
1 parent 76e31e2 commit c5f033f

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

typed_python/compiler/runtime.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,39 @@ def compileFunctionOverload(self, functionType, overloadIx, arguments, arguments
324324
)
325325

326326
def compileClassDispatch(self, interfaceClass, implementingClass, slotIndex):
327+
t0 = time.time()
328+
327329
with self.lock:
328-
self.converter.compileSingleClassDispatch(interfaceClass, implementingClass, slotIndex)
330+
self.converter.compileSingleClassDispatch(
331+
interfaceClass, implementingClass, slotIndex
332+
)
333+
334+
if self.verbosityLevel > 0:
335+
name, retType, argTypeTuple, kwargTypeTuple = (
336+
_types.getClassMethodDispatchSignature(
337+
interfaceClass, implementingClass, slotIndex
338+
)
339+
)
340+
341+
print(
342+
f"typed_python runtime spent {time.time()-t0:.3f} seconds compiling dispatch "
343+
f"{implementingClass} as {interfaceClass} method {name}"
344+
)
329345

330346
return True
331347

332348
def compileClassDestructor(self, cls):
349+
t0 = time.time()
350+
333351
with self.lock:
334352
self.converter.compileClassDestructor(cls)
335353

354+
if self.verbosityLevel > 0:
355+
print(
356+
f"typed_python runtime spent {time.time()-t0:.3f} seconds compiling destructor "
357+
f"{cls}"
358+
)
359+
336360
return True
337361

338362
def resultTypeForCall(self, funcObj, argTypes, kwargTypes):

0 commit comments

Comments
 (0)