hdl.ast: remove quadratic time complexity in Statement.cast().
authorAnton Blanchard <anton@ozlabs.org>
Mon, 27 Sep 2021 01:00:56 +0000 (11:00 +1000)
committerGitHub <noreply@github.com>
Mon, 27 Sep 2021 01:00:56 +0000 (01:00 +0000)
commit9f78ac0691ef55feda885780f21960e05c7a85a5
treea8d8b6204cd98cbf5f5539a14637739587b387b5
parent9834b7e95f3d146d51b7c8aa654dbd37df8babf4
hdl.ast: remove quadratic time complexity in Statement.cast().

Using `sum(lst, [])` to flatten a list of lists has quadratic time
complexity. Use `chain.from_iterable()` instead. While not strictly
necessary to improve performance, convert to `map()`.

A test case writing out verilog for a 512k entry FIFO is 120x faster
with this applied.
nmigen/hdl/ast.py