From a0d23c1192712be1a5970bb70bb8f0cbafbe4e11 Mon Sep 17 00:00:00 2001 From: edwardcwang Date: Tue, 10 Jul 2018 15:55:23 -0700 Subject: 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 --- src/main/scala/firrtl/passes/InferWidths.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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 } -- cgit v1.2.3