[Improvement]: Optimize BIRPackage.importModules
to not contain duplicate BIRImportModule
elements
#42343
Labels
needTriage
The issue has to be inspected and labeled manually
Type/Improvement
userCategory/Compilation
Description
It is possible to optimize the BIRGen and Codegen phases by restricting the addition of duplicate
BIRImportModule
elements to theimportModules
attribute ofBIRPackage
.As of now duplicate elements are added due to the usage of an
ArrayList
to hold theBIRImportModule
elements.Describe your problem(s)
These duplicate elements are being traversed by a for loop in the CodeGen phase,
This could create an unnecessary performance overhead for the compilation.
Describe your solution(s)
This process can be optimized by the usage of a
HashSet
instead of anArrayList
and setting up the necessaryequals
andhashCode
functions for theBIRImportModule
class. Which will prevent the addition of duplicate elements.Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: