-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
While profiling a script in package:win32 I noticed a large amount of time was spent in contains() on a const List. Switching it to a const Set shaved off around 10% of the entire runtime of the script:
The question came up of whether the compiler/runtime could be smarter about it (eg. detect contains() on Lists and do some magic behind the scenes to make it a lookup). I'm not sure if that's feasible (although if it is, that may be better) so wondered if a lint may make sense.
I'm not certain if it would end up producing a lot of false positives (or just reports where the savings are so small that they're not worth the error to report/fix), or exactly what situations would make sense to warn, but I thought it my be worth raising for opinions at least.