diff options
| author | edwardcwang | 2018-07-10 15:55:23 -0700 |
|---|---|---|
| committer | Jack Koenig | 2018-07-10 15:55:23 -0700 |
| commit | a0d23c1192712be1a5970bb70bb8f0cbafbe4e11 (patch) | |
| tree | 1622489d16206e54f9151b2980be35758edeb146 /src | |
| parent | f03a88032fa6dd6abd3cd951608561640086106a (diff) | |
InferWidths: improve performance (#846)
On circuits with large numbers of width inferences, prepend to a linked
list instead of appending and having to make a copy.
Fixes #842
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/firrtl/passes/InferWidths.scala | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/scala/firrtl/passes/InferWidths.scala b/src/main/scala/firrtl/passes/InferWidths.scala index 9ccd8c78..1e9532c8 100644 --- a/src/main/scala/firrtl/passes/InferWidths.scala +++ b/src/main/scala/firrtl/passes/InferWidths.scala @@ -41,13 +41,13 @@ object InferWidths extends Pass { case wx => wx } def collectMinMax(w: Width): Width = w map collectMinMax match { - case MinWidth(args) => MinWidth(unique((args.foldLeft(Seq[Width]())) { - case (res, wxx: MinWidth) => res ++ wxx.args - case (res, wxx) => res :+ wxx + case MinWidth(args) => MinWidth(unique(args.foldLeft(List[Width]()) { + case (res, wxx: MinWidth) => wxx.args ++: res + case (res, wxx) => wxx +: res })) - case MaxWidth(args) => MaxWidth(unique((args.foldLeft(Seq[Width]())) { - case (res, wxx: MaxWidth) => res ++ wxx.args - case (res, wxx) => res :+ wxx + case MaxWidth(args) => MaxWidth(unique(args.foldLeft(List[Width]()) { + case (res, wxx: MaxWidth) => wxx.args ++: res + case (res, wxx) => wxx +: res })) case wx => wx } |
