Hi Bruno,

On 4/5/24 5:58 AM, Bruno Haible wrote:
> Sure. It was a translation of the shell code:

Ah, yeah that makes sense.

> Finding the maximum of a list directly is O(N). Finding it by sorting
> the list is O(N log N). Therefore it is clear which of the two should
> be preferred :)

I was looking at simplifying some list comprehensions yesterday and
noticed that using sets + removing unnecessary sorted() calls in
GLModuleTable reduces the time of ./import-tests/test-all.sh from 4.8
seconds to 4.5 seconds consistently. A truly life changing amount of
time.

You can probably notice this by looking in
GLModuleTable.transitive_closure and
GLModuleTable.transitive_closure_separately. Most of the time we are
checking if a module is in a list, O(N). It makes more sense to use a
set, O(1).

The only issue with that is it becomes annoying to deal with the dummy
module. Is there a reason why that one doesn't get sorted?

Collin

Reply via email to