Commit Graph

10242 Commits

Author SHA1 Message Date
Ethan Atkins 67e7b51979
Merge pull request #5701 from eatkins/build-load-perf
Improve sbt build load time by 25%
2020-07-27 08:49:50 -07:00
Eugene Yokota 8c1f6e3c34 Fix root doc 2020-07-27 02:28:47 -04:00
Ethan Atkins 38d67cfdf0 Improve sbt build load time by 25%
The sbt project load made a number of relatively inefficient
transformations of scala collecitons. I went through and found the slow
parts during project loading and made my best attempt at fixing them.
The most significant changes I made were in places using IMap. An IMap
is more or less a wrapper around an immutable Map. It can be much faster
to construct an IMap by creating a java mutable hashmap, wrapping it a
scala Map that delegates to the underlying java hashmap (with a copy on
write if the map is modified) and constructing the IMap from the wrapped
map. It was also in many cases to parallelize some transformations
wherever the order didn't matter.

After applying all of these changes, I found that loading the sbt
project took generally between 8.5 and 9 seconds on my laptop. With
1.3.13, it hovered around 11.5 seconds. I saw a similar speedup in zinc.
The biggest specific improvement was that generating the compiled map
dropped from between 3.5-4 seconds to pretty consistently being around
1.5 seconds.
2020-07-26 19:52:26 -07:00
Eugene Yokota 44e39ec15e Drop unused Sxr 2020-07-25 15:26:35 -04:00
eugene yokota 627a79c254
Merge pull request #5699 from sbt/pr/5697
Zinc 1.4.0-M7
2020-07-25 12:03:34 -04:00
Eugene Yokota 9fbef411bf Comment out test that is timing out 2020-07-25 10:26:33 -04:00
Eugene Yokota fdae1a1858 Bring back Dotty 2020-07-25 00:29:56 -04:00
Eugene Yokota 9c18fb0cf6 Remove tests that are in Zinc repo 2020-07-25 00:23:58 -04:00
Eugene Yokota 7741b9ae2d Zinc 1.4.0-M7 2020-07-24 23:50:54 -04:00
eugene yokota 6a29b7f927
Merge pull request #5696 from eatkins/progress-blinking
Make progress lines blink less
2020-07-24 00:23:59 -04:00
Ethan Atkins eb88d523e0 Update sbt for latest zinc apis 2020-07-22 15:00:56 -07:00
Ethan Atkins d68e2a6361 Make progress lines blink less
The more we call flush, the more likely progress status is to blink. To
reduce the amount of calls to flush, we can instead batch all of the
bytes that are going to be written and wriite them all at once. This
change made progress noticeably less blinky in the zinc project running
the latest sbt snapshot (which frankly was almost siezure inducing when
running publishLocal)
2020-07-22 14:55:25 -07:00
Ethan Atkins 88e0bd678a
Merge pull request #5695 from eatkins/client-system-err
Support System.err in thin client
2020-07-22 14:54:17 -07:00
Ethan Atkins 7b39118214
Merge branch 'develop' into client-system-err 2020-07-22 09:16:10 -07:00
eugene yokota 3908949d73
Merge pull request #5688 from eatkins/client-jline-ui-fixes
Miscellaneous ui/jline fixes
2020-07-21 23:06:44 -04:00
Ethan Atkins 9b332379dd Clear prompt on log messages
Printing a new line was not great ux. You might see something like:

[info] set current project to project (in build file:project)
sbt:project>
[info] new client connected: network-1
sbt:project>

instead of initially

[info] set current project to project (in build file:project)
sbt:project>

and then after the client connects:
[info] set current project to project (in build file:project)
[info] new client connected: network-1
sbt:project>
2020-07-21 13:27:44 -07:00
Ethan Atkins 12112741cb Revert "Unprompt channels during project load"
This reverts commit b1dcf031a5.

I found that b1dcf031a5 had some
unintended consequences that seemed to mess up the prompt state. The
real problem that it was trying to address was that the prompt was being
interleaved with log messages in some scenarios. There was a different
way to fix that in ProgressState that was both simpler and more
reliable.
2020-07-21 13:27:44 -07:00
Ethan Atkins 901c8ee5df Use new history file path for jline3
The jline2 history file format is incompatible with jline3 and jline3
prints a very noisy warning if it detects such a file. History will also
not work with jline3 until you remove or reformat the old file.
2020-07-21 13:27:44 -07:00
Ethan Atkins 761c926944 Catch ClosedChannelException in TaskTraceEvent
sbt would print a stack trace on exit when run with
-Dsbt.task.timings=true. This removes that annoying stack trace.
2020-07-21 13:27:44 -07:00
Ethan Atkins cd26abd656 Print ClearScreenAfterCursor on shutdown
There are scenarios in which sbt can leave behind stray progress lines
after it exits. This attempts to delete them.
2020-07-21 13:27:44 -07:00
Ethan Atkins e82c3405b9 Support System.err in thin client
I noticed that when reloading the build, that certain errors are logged
by sbt to System.err. These were not shown to a thin client because we
weren't forwarding System.err. This change remedies that.

System.err is handled more simply than System.out. We do not put
System.err through the progress state because generally System.err is
tends to be unbuffered. I had hesitated to add System.err to the
Terminal interface at all to give users an escape hatch but I couldn't
get project loading to work well with the thin client without it.
2020-07-21 13:27:32 -07:00
eugene yokota d53ebaa686
Merge pull request #5680 from adpi2/develop
Make the BuildServerReporter stop blinking
2020-07-21 15:35:32 -04:00
adpi2 ac06026015 Exit BspClient after server socket is closed 2020-07-20 16:53:37 +02:00
eugene yokota e985d77ace
Merge pull request #5690 from eatkins/jline2-raw-mode
Use jline2 for raw mode
2020-07-20 07:23:07 -04:00
eugene yokota 23ade8c650
Merge pull request #5692 from eatkins/task-progress
Clear singleton TaskProgress between runs
2020-07-20 07:19:58 -04:00
adpi2 6c694fb04d Rework BuildServerReporter
Make it stop blinking
Use `reset` field to reduce verbosity
2020-07-20 09:17:12 +02:00
Ethan Atkins f7f25bea81
Merge branch 'develop' into task-progress 2020-07-19 21:42:00 -07:00
Ethan Atkins 8bd43a9fa3
Merge pull request #5689 from eatkins/parallel-stamping
Stamp source files in parallel
2020-07-19 21:41:44 -07:00
Ethan Atkins c6ef4c477d
Merge branch 'develop' into parallel-stamping 2020-07-19 18:31:21 -07:00
Ethan Atkins 28ded81fba
Merge pull request #5521 from eatkins/external-hooks
Restore zinc source file invalidation performance
2020-07-19 18:30:53 -07:00
Ethan Atkins d227b6423f Clear singleton TaskProgress between runs
In db4878c786, TaskProgress became an
object which mostly made things easier to reason about. The one problem
was that it started leaking tasks with every run because the timings map
would accumulate tasks that weren't cleared. To fix this, we can clear
the timings and activeTasksMap in the TaskProgress object in the
afterAllCompleted callback. Some extra null checks needed to be added
since it's possible for the maps to not contain a previously added key
after reset has been called.
2020-07-19 13:08:56 -07:00
Ethan Atkins a19ec581c0 Use jline2 for raw mode
Using the JLine3 implementation of raw mode breaks the scala console for
the console channel.
2020-07-19 12:51:19 -07:00
Ethan Atkins 1b5cbd8ead Stamp source files in parallel
I noticed a modest performance increase could be achieved by stamping
the source files in parallel.
2020-07-19 12:21:25 -07:00
Ethan Atkins e81d459f69 Remove custom ExternalHooks
This is now handled by passing a custom instance of ReadStamps to
CompileOptions instead.
2020-07-19 12:16:37 -07:00
Ethan Atkins 329d989e73 Use sbt source file stamps in zinc
This fixes the nio/external-hooks test and also restores the performance
of the benchmarks for the latest sbt version in
https://github.com/eatkins/scala-build-watch-performance which had
regressed when the custom ExternalHooks were disabled in
7c4b01d9f7.

The main change is that it changes the ReadStamps object that is passed
into the compiler options to one that uses the unmanagedFileStampCache
and managedFileStampCache for source files and falls back to the default
stamper otherwise. This improves the performance quite significantly
since we only hash the files once. It also makes it so that the analysis
file will contain the source file stamps of the files when compilation
began, rather than when compilation ended. That is what
nio/external-hooks was testing. In the real world what could happen was
that one modified a source file during compilation but then no
incremental re-compilation would occur because after the initial
compilation completed, zinc wrote the stamp of the modified source file
in the analysis file even though it may have actually compiled a
different version of the source file.
2020-07-19 12:16:37 -07:00
eugene yokota b678d2115f
Merge pull request #5687 from eatkins/rejected-execution
Handle closed executor in network channel flush
2020-07-19 13:47:15 -04:00
Ethan Atkins 4acf3d14c2 Handle closed executor in network channel flush
I noticed some RejectedExecutionExceptions in travis failures of
ClientTest. This could happen if we try to write output to the
network channel after it has been closed. To avoid this problem, we can
catch RejectedExecutionExceptions and do an immediate flush if the
executor has been shutdown.
2020-07-19 10:09:54 -07:00
Jacob Wang af7acdf3de
Merge pull request #192 from MasseGuillaume/optimize-width-browser
Optimize the screen space for dependencyBrowseGraph
2020-07-14 11:40:54 +12:00
Guillaume Massé ad3acd86f4 Optimize the screen space for dependencyBrowseGraph 2020-07-13 15:27:05 -04:00
eugene yokota 8b73d2bc2a
Merge pull request #5674 from adpi2/fix/connection-details
Specify full java path in BSP connection details
2020-07-13 14:27:31 -04:00
adpi2 2c0d09dfb3 Specify full java path in BSP connection details
Use System properties to add java path and classpath to BSP connection details
2020-07-13 13:13:54 +02:00
eugene yokota eceb1d896e
Merge pull request #5672 from eatkins/xmain-configuration-fix
Add improved classloader construction short circuit
2020-07-12 23:58:16 -04:00
Ethan Atkins 464ea1b97e Add improved classloader construction short circuit
In order for sbt to function well, it needs the test interface, jansi
and forked jline jars provided by a classloader that is parent to all
other sbt classloaders. To do this for just the test interface jar, I
just checked if the top loader in the app configuration had the correct
name. Now that there are three jars, this is more complicated so I
updated the launcher to create a top loader with the method getEarlyJars
implemented and returning the three needed jars. This is a much more
scalable design.

If sbt is entered with a configuration that does not have a top loader
with the getEarlyJars method defined, then we just fall back on
constructing the default layered classlaoder from the configuration
classpath.

The motivation for this change is that I discovered that sbt immediately
crashed when I tried to run a non-snapshot version. After this change, I
verified that both snapshot and non-snapshot versions of the latest sbt
code could load with both an obsolete and up-to-date launcher.
2020-07-12 17:49:01 -07:00
eugene yokota 6110734383
Merge pull request #5673 from eatkins/client-watch-fixes
UI fixes for remote client in watch
2020-07-12 00:55:03 -04:00
eugene yokota ab5e57afb1
Merge pull request #5671 from eatkins/upgrade-to-jline3
Upgrade to jline3
2020-07-11 20:35:10 -04:00
Ethan Atkins baa96be6dc Use unprompt in watch to better manage ui state
The unprompt method will actually kill the ui thread if its running. If
we don't to this, we can get into a weird state where after watch is
exited by <enter>, the ask user thread spins up but before it can print
the prompt, the terminal prompt is changed to Running, which has an
empty prompt. The end result is that jline3 never displays the prompt
even though the line reader is active and reading bytes. When the user
typed <enter> a prompt would appear. They also could input a command and
it would run but it wasn't obvious what would happen since the prompt
was missing.
2020-07-10 14:26:16 -07:00
Ethan Atkins 3ddc7bd744 Remove unneeded println
While I'm sure this was added for a reason, it presently is creating
unnecessary and ugly newlines to the console during `~`.
2020-07-10 14:26:14 -07:00
Ethan Atkins 9dc3c6b17f Use terminal printstream in CheckBuildSources
The build source check is evaluated at times when we can't be completely
sure that global logger is pointing at the terminal that initiated the
reload (which may be a passive watch client). To work around this, we
can inspect the exec to determine which terminal initiated the check and
write any output directly to that terminal.
2020-07-10 13:37:54 -07:00
Ethan Atkins 25e83d8fec Add Terminal.withRawOutput api
In the scala console, it's essential that we not process the bytes that
are written to the terminal by jline.
2020-07-10 13:37:54 -07:00
Ethan Atkins bc4fe0a31a Cross build collectionProj 2020-07-10 13:37:54 -07:00