You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed during the bug fix for #524 that the wrapper module for mshtml.tlb have a considerably large file size.
Given the large number of definitions in the COM type library, it’s inevitable that the file size of the mshtml.tlb wrapper module becomes large.
However, in the current comtypes implementation, CodeGenerator.ComInterfaceBody generates comments proportional to the number of COM interfaces and methods.
I attempted to reduce the file size by removing these comments.
Actual behaviors
Using Python 3.10.10, I compared the output values obtained by running the following script with the codebase at commit c8f3e2e as is, and with the codebase where the part that generates comments in CodeGenerator.ComInterfaceBody has been removed.
with generating comments by CodeGenerator.ComInterfaceBody
30.91 13365249
without generating comments by CodeGenerator.ComInterfaceBody
30.78 12693666
There is a difference of about 0.64MB in file size.
There is also a difference of more than 0.1 seconds in the time it takes to generate the module.
With the type annotation feature introduced from comtypes==1.3.1, if we simply want to know the interface, we can now refer to static type hints.
So, these comments might have served their purpose.
However, these comments have been around for a long time, so caution is needed when removing them.
I am soliciting opinions from the community on whether it is better to reduce the file size and the time it takes to generate by removing these comments, or whether we should keep them for backward compatibility.
Any opinion would be appreciated.
The text was updated successfully, but these errors were encountered:
I noticed during the bug fix for #524 that the wrapper module for
mshtml.tlb
have a considerably large file size.Given the large number of definitions in the COM type library, it’s inevitable that the file size of the mshtml.tlb wrapper module becomes large.
However, in the current
comtypes
implementation,CodeGenerator.ComInterfaceBody
generates comments proportional to the number of COM interfaces and methods.comtypes/comtypes/tools/codegenerator.py
Lines 1185 to 1253 in c8f3e2e
I attempted to reduce the file size by removing these comments.
Actual behaviors
Using Python 3.10.10, I compared the output values obtained by running the following script with the codebase at commit c8f3e2e as is, and with the codebase where the part that generates comments in
CodeGenerator.ComInterfaceBody
has been removed.Execution results
with generating comments by
CodeGenerator.ComInterfaceBody
without generating comments by
CodeGenerator.ComInterfaceBody
There is a difference of about 0.64MB in file size.
There is also a difference of more than 0.1 seconds in the time it takes to generate the module.
With the type annotation feature introduced from
comtypes==1.3.1
, if we simply want to know the interface, we can now refer to static type hints.So, these comments might have served their purpose.
However, these comments have been around for a long time, so caution is needed when removing them.
I am soliciting opinions from the community on whether it is better to reduce the file size and the time it takes to generate by removing these comments, or whether we should keep them for backward compatibility.
Any opinion would be appreciated.
The text was updated successfully, but these errors were encountered: