New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

++ in 0.13.x is exponential #3735

Closed
OlivierBlanvillain opened this Issue Nov 13, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@OlivierBlanvillain

OlivierBlanvillain commented Nov 13, 2017

Something is exponential in the implementation of ++. For instance, the following takes about 2 minutes to execute and grows to 4 minutes when adding another ++:

sbt ";++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;++2.12.3 ;++2.12.4 ;exit"

Attaching to the process with jstack shows that sbt is busy growing a Seq:

Stack trace
  "main" #1 prio=5 os_prio=0 tid=0x00007f0278009800 nid=0x477f runnable [0x00007f0281192000]
     java.lang.Thread.State: RUNNABLE                                                 
          at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:48)
          at scala.collection.generic.Growable$$anonfun$$plus$plus$eq$1.apply(Growable.scala:48)
          at scala.collection.immutable.List.foreach(List.scala:318)
          at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48) 
          at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:176)
          at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:45)   
          at scala.collection.SeqLike$class.$colon$plus(SeqLike.scala:529)
          at scala.collection.AbstractSeq.$colon$plus(Seq.scala:40)                   
          at sbt.Init$class.append(Settings.scala:168)               
          at sbt.Def$.append(Def.scala:10)                                            
          at sbt.Init$$anonfun$add$1.apply(Settings.scala:165)
          at sbt.Init$$anonfun$add$1.apply(Settings.scala:165)                              
          at sbt.IMap$IMap0.mapValue(PMap.scala:52)
          at sbt.IMap$IMap0.mapValue(PMap.scala:46)
          at sbt.Init$class.add(Settings.scala:165)
          at sbt.Def$.add(Def.scala:10)                           
          at sbt.Init$$anonfun$grouped$1.apply(Settings.scala:162)
          at sbt.Init$$anonfun$grouped$1.apply(Settings.scala:162)
          at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:111)
          at scala.collection.immutable.List.foldLeft(List.scala:84)
          at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:138)
          at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:105)
          at sbt.Init$class.grouped(Settings.scala:162)
          at sbt.Def$.grouped(Def.scala:10)
          at sbt.Init$class.compiled(Settings.scala:136)
          at sbt.Def$.compiled(Def.scala:10)
          at sbt.Init$class.make(Settings.scala:144)
          at sbt.Def$.make(Def.scala:10)
          at sbt.Load$.reapply(Load.scala:216)
          at sbt.BuiltinCommands$.reapply(Main.scala:298)
          at sbt.Cross$$anonfun$switchVersion$2.apply(Cross.scala:85)
          at sbt.Cross$$anonfun$switchVersion$2.apply(Cross.scala:34)
          at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
          at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
          at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
          at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
          at sbt.Command$.process(Command.scala:93)
          at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
          at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
          at sbt.State$$anon$1.doX$1(State.scala:183)
          at sbt.State$$anon$1.process(State.scala:190)
          at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
          at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
          at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
          at sbt.MainLoop$.next(MainLoop.scala:96)
          at sbt.MainLoop$.run(MainLoop.scala:89)
          at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
          at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
          at sbt.Using.apply(Using.scala:24)
          at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
          at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
          at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
          at sbt.MainLoop$.runLogged(MainLoop.scala:22)
          at sbt.StandardMain$.runManaged(Main.scala:109)
          at sbt.xMain.run(Main.scala:38)
          at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
          at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
          at xsbt.boot.Launch$.run(Launch.scala:109)
          at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
          at xsbt.boot.Launch$.launch(Launch.scala:117)
          at xsbt.boot.Launch$.apply(Launch.scala:18)
          at xsbt.boot.Boot$.runImpl(Boot.scala:41)
          at xsbt.boot.Boot$.main(Boot.scala:17)
          at xsbt.boot.Boot.main(Boot.scala)
@2m

This comment has been minimized.

Member

2m commented Nov 13, 2017

How are GC times? I noticed that adding -J-XX:ReservedCodeCacheSize=256M when running sbt decreases Compiling compiler interface ... times drastically when on Tracis CI.

@eed3si9n

This comment has been minimized.

Member

eed3si9n commented Jul 18, 2018

On sbt 1.2.0 RC-3 it takes 13s, so it goes fixed?

@eed3si9n eed3si9n closed this Jul 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment