Skip to content
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

Bash runner script exhibits quadratic performance and is unreasonably slow with many source files #9279

Closed
scabug opened this issue Apr 23, 2015 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Apr 23, 2015

Analysis https://gist.github.com/retronym/3be212b836de6537cc1b

@scabug
Copy link
Author

scabug commented Apr 23, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9279?orig=1
Reporter: @retronym
Affected Versions: 2.11.6

@scabug scabug closed this as completed Apr 27, 2015
@scabug
Copy link
Author

scabug commented Jun 19, 2015

@SethTisue said:
scala/scala#4465

@scabug scabug added this to the 2.11.7 milestone Apr 7, 2017
retronym added a commit to retronym/scala that referenced this issue May 3, 2017
Echoing the performance bug in the bash scripts (scala/bug#9279),
the command line parser exhibited exponential performance.

When using the command line arguments used to compile the standard
library, which contains ~ 700 source files, I noticed about 1% of
compilation time was being spend in evaluating the regex `(\S+)(.*)`.
Inspection of the parser reveals that this was repeatedly being
called on the rest of the command line as the parser consumed
each argument.

This commit switches to using a regex that only matches the
current argument, and then makes sure to split the input
string using structural sharing of the backing char[] (by using
`CharSequence.subsequence`, rather than high level Scala collections
operations from `StringLike`).

After this change, I no longer this area of code in the profiler
results.
retronym added a commit to retronym/scala that referenced this issue May 3, 2017
Echoing the performance bug in the bash scripts (scala/bug#9279),
the command line parser exhibited exponential performance.

When using the command line arguments used to compile the standard
library, which contains ~ 700 source files, I noticed about 1% of
compilation time was being spend in evaluating the regex `(\S+)(.*)`.
Inspection of the parser reveals that this was repeatedly being
called on the rest of the command line as the parser consumed
each argument.

This commit switches to using a regex that only matches the
current argument, and then makes sure to split the input
string using structural sharing of the backing char[] (by using
`CharSequence.subsequence`, rather than high level Scala collections
operations from `StringLike`).

After this change, I no longer observed this area of code in the
top profiler results.
retronym added a commit to retronym/scala that referenced this issue May 15, 2017
Echoing the performance bug in the bash scripts (scala/bug#9279),
the command line parser exhibited exponential performance.

When using the command line arguments used to compile the standard
library, which contains ~ 700 source files, I noticed about 1% of
compilation time was being spend in evaluating the regex `(\S+)(.*)`.
Inspection of the parser reveals that this was repeatedly being
called on the rest of the command line as the parser consumed
each argument.

This commit switches to using a regex that only matches the
current argument, and then makes sure to split the input
string using structural sharing of the backing char[] (by using
`CharSequence.subsequence`, rather than high level Scala collections
operations from `StringLike`).

After this change, I no longer observed this area of code in the
top profiler results.
retronym added a commit to retronym/scala that referenced this issue May 15, 2017
Echoing the performance bug in the bash scripts (scala/bug#9279),
the command line parser exhibited exponential performance.

When using the command line arguments used to compile the standard
library, which contains ~ 700 source files, I noticed about 1% of
compilation time was being spend in evaluating the regex `(\S+)(.*)`.
Inspection of the parser reveals that this was repeatedly being
called on the rest of the command line as the parser consumed
each argument.

This commit switches to using a regex that only matches the
current argument, and then makes sure to split the input
string using structural sharing of the backing char[] (by using
`String.substring`, rather than high level Scala collections
operations from `StringLike#span`).

After this change, I no longer observed this area of code in the
top profiler results.
retronym added a commit to retronym/scala that referenced this issue May 15, 2017
Echoing the performance bug in the bash scripts (scala/bug#9279),
the command line parser exhibited exponential performance.

When using the command line arguments used to compile the standard
library, which contains ~ 700 source files, I noticed about 1% of
compilation time was being spend in evaluating the regex `(\S+)(.*)`.
Inspection of the parser reveals that this was repeatedly being
called on the rest of the command line as the parser consumed
each argument.

This commit switches to using a regex that only matches the
current argument, and then makes sure to split the input
string using structural sharing of the backing char[] (by using
`String.substring`, rather than high level Scala collections
operations from `StringLike#span`).

After this change, I no longer observed this area of code in the
top profiler results.
retronym added a commit to retronym/scala that referenced this issue May 15, 2017
Echoing the performance bug in the bash scripts (scala/bug#9279),
the command line parser exhibited exponential performance.

When using the command line arguments used to compile the standard
library, which contains ~ 700 source files, I noticed about 1% of
compilation time was being spend in evaluating the regex `(\S+)(.*)`.
Inspection of the parser reveals that this was repeatedly being
called on the rest of the command line as the parser consumed
each argument.

This commit switches to using a regex that only matches the
current argument, and then makes sure to split the input
string using structural sharing of the backing char[] (by using
`String.substring`, rather than high level Scala collections
operations from `StringLike#span`).

After this change, I no longer observed this area of code in the
top profiler results.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants