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)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 15:31:40 +0000 (15:31 +0000)
commit1bc66b3c4a5babb99b6ad605f5a823bbe4de75a7
tree1e87e7f838e01df272926f054694aad4114cb7e0
parentc746a4b2e79b7d102d90e55c9832fa334a8d34e4
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