Bundle and optimize - #2139
Conversation
…dOptimize # Conflicts: # src/Language/PureScript/Bundle.hs # src/Language/PureScript/BundleOpt.hs # src/Language/PureScript/BundleTypes.hs
# Conflicts: # psc-bundle/Main.hs # src/Language/PureScript/Bundle.hs
| - 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 |
There was a problem hiding this comment.
Curious, why -p and not something like -O?
There was a problem hiding this comment.
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.
| if secondRun | ||
| then do | ||
| modules'' <- traverse (fmap withDeps . pure) modules' -- traverse and compile again | ||
| return (compile modules'' entryPoints) |
There was a problem hiding this comment.
Could you please add a comment explaining why it's necessary to compile twice?
There was a problem hiding this comment.
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.
|
Could you please update 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. |
| - [@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. |
There was a problem hiding this comment.
Typo; still says "Hardy Jones"
| <*> many entryPoint | ||
| <*> optional mainModule | ||
| <*> namespace | ||
| <*> (optional (not <$> noShouldUncurry) <|> optional shouldUncurry) |
There was a problem hiding this comment.
Doesn't this mean -O does nothing? Let's just have one option.
|
Closed this, because I resubmitted as #2219 |
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.