Hi,
shouldn't be EnsureDispatch be faster than Dispatch once the code
generation is done?
I've measured it by calling 6000 COM calls like this:
dirpath = Path('C:/Users/sbardos/AppData/Local/Temp/gen_py/3.10/')
if dirpath.exists() and dirpath.is_dir():
shutil.rmtree(dirpath)
app = Dispatch("CT.Application")
job = app.CreateJobObject()
start = timer()
for i in range(2000):
cnt, devIds = job.GetAllDeviceIds()
cnt, sheetIds = job.GetSheetIds()
dev = job.CreateDeviceObject()
end = timer()
print(f"Time ellapsed (late): {end - start}s")
and the ensure Dispatch version:
app = EnsureDispatch("CT.Application")
job = app.CreateJobObject()
start = timer()
for i in range(2000):
cnt, devIds = job.GetAllDeviceIds(None)
cnt, sheetIds = job.GetSheetIds(None)
dev = job.CreateDeviceObject()
end = timer()
print(f"Time ellapsed (early): {end - start}s")
EnsureDispatch is a little bit slower ~4.2s compared to ~4.0s.
If I don't get a performance boost with EnsureDispatch, is there even a
point using it?
Thanks,
Sven
_______________________________________________
python-win32 mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-win32