purescript-contrib / pulp

A build tool for PureScript projects
GNU Lesser General Public License v3.0
445 stars 86 forks source link

faster `--watch` and `faster --to` #268

Open rvion opened 7 years ago

rvion commented 7 years ago

For now, pulp --watch build is much slower than other custom alternatives.

Example: On halogen programs, live reloading on bundle change is up to 2 order of magnitudes slower (~100 times slower) than a custom psc-ide based watch-rebuild tool + webpack with code splitting and Hot module replacement

Today, most people coming to PureScript use pulp --watch build.

I think we could enhance drastically the developper experience by harvesting low hanging fruits.

faster --watch

I think we could we make pulp --watch build way faster.

pulp could

  1. start purs ide
  2. :load all modules
  3. on *.purs change: only :rebuild the changed module
  4. on */extern.json change: invalidate dependant modules, and recompile them

it may even be simpler if purs ide already rebuild changed dependencies, but only those.

in this case, pulp could

  1. start purs ide
  2. :load all modules
  3. on *.purs change: only :rebuild the main module

faster --to

in development settings without optimisations,

pulp --to option could do one or all of those:

  1. be concurrent with the re-building task
  2. cache module subtrees to avoid recompilation
  3. create splitted output (ex: vendor.js for dependencies + main.js for application)
  4. be compatible with the pulp server so bundles are served without being written in the disk
hdgarrood commented 7 years ago

Sounds sensible. I don't want pulp to include any dependency tracking though, the compiler takes care of that currently and I would really rather keep it that way.