Skip to content

Bundle and optimize - #2139

Closed
jutaro wants to merge 28 commits into
purescript:0.9from
mgmeier:0.9
Closed

Bundle and optimize#2139
jutaro wants to merge 28 commits into
purescript:0.9from
mgmeier:0.9

Conversation

@jutaro

@jutaro jutaro commented May 18, 2016

Copy link
Copy Markdown

See issue Uncurry optimization #479. Here's the read-up: http://symbolian.net/2016/04/07/513.
Replaces #2111, as it is now based on 0.9.

@jutaro jutaro mentioned this pull request May 18, 2016
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.7%) to 54.223% when pulling f053218 on jutaro:0.9 into 4852b5d on purescript:0.9.

Comment thread psc-bundle/README.md Outdated
- Entry point module name(s) are specified with `-m` or `--module`. All code which is not a transitive dependency of an entry point module will be removed.
- The main module is (optionally) specified using `--main`. If specified, this will generate code to run the main method in the specified module.
- The browser namespace defaults to `PS`, and can be overridden with `--namespace`.
- The optimization options are specified with `-p` or `--optimize`. Currently the only option is `uncurry` or `u`, which performs an uncurry optimization

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why -p and not something like -O?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, psc has a separate command line flag (not option, i.e. no argument) for each optimization it supports. Unless there's a good reason not to, I think it would probably be good to have psc-bundle be consistent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readme updated.

Comment thread src/Language/PureScript/Bundle.hs Outdated
if secondRun
then do
modules'' <- traverse (fmap withDeps . pure) modules' -- traverse and compile again
return (compile modules'' entryPoints)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a comment explaining why it's necessary to compile twice?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comment:

  -- The uncurry optimization performs dead code elemination (DCE) once and then
  -- generates uncurried variants of the surviving functions. We need to
  -- perform DCE again to throw away variants (curried or uncurried) that
  -- aren't called after choosing the appropriate variant for each call site.
  -- This two-step process avoids generating variants for functions that
  -- are dead weight anyway.

@paf31

paf31 commented May 30, 2016

Copy link
Copy Markdown
Contributor

Could you please update CONTRIBUTORS.md?

I'll try to go through this more thoroughly some time this week. I'm guessing we'll probably try to merge this in for 0.9.2.

Comment thread CONTRIBUTORS.md
- [@jacereda](https://github.com/jacereda) (Jorge Acereda) My existing contributions and all future contributions until further notice are Copyright Jorge Acereda, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
- [@japesinator](https://github.com/japesinator) (JP Smith) My existing contributions and all future contributions until further notice are Copyright JP Smith, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
- [@joneshf](https://github.com/joneshf) (Hardy Jones) - My existing contributions and all future contributions until further notice are Copyright Hardy Jones, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.
- [@jutaro](https://github.com/jutaro) (Jürgen Nicklisch-Franken) - My existing contributions and all future contributions until further notice are Copyright Hardy Jones, and are licensed to the owners and users of the PureScript compiler project under the terms of the MIT license.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo; still says "Hardy Jones"

Comment thread psc-bundle/Main.hs
<*> many entryPoint
<*> optional mainModule
<*> namespace
<*> (optional (not <$> noShouldUncurry) <|> optional shouldUncurry)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this mean -O does nothing? Let's just have one option.

@jutaro

jutaro commented Jul 6, 2016

Copy link
Copy Markdown
Author

Closed this, because I resubmitted as #2219

@jutaro jutaro closed this Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants