Skip to content

Instantly share code, notes, and snippets.

@eeue56
Last active April 20, 2018 16:44
Show Gist options
  • Select an option

  • Save eeue56/4fbf9fedfb03479410d7a21be69f2f3a to your computer and use it in GitHub Desktop.

Select an option

Save eeue56/4fbf9fedfb03479410d7a21be69f2f3a to your computer and use it in GitHub Desktop.

Repo: https://github.com/rtfeldman/elm-spa-example

Clean build

noah@Noahs-MacBook-Pro ~/d/elm-spa-example> time elm-make src/Main.elm --output /dev/null
Success! Compiled 93 modules.
Successfully generated /dev/null
        8.44 real        15.88 user        16.76 sys

Other info

noah@Noahs-MacBook-Pro ~/d/elm-spa-example> cloc .
     242 text files.
     233 unique files.
      35 files ignored.

github.com/AlDanial/cloc v 1.72  T=1.14 s (182.2 files/s, 42179.3 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
HTML                             1           1002              0          16862
Elm                            122           5727           4610          11497
JavaScript                      22           1036            243           5302
Markdown                        27            367              0            880
JSON                            28              0              0            498
YAML                             4             11              0             75
Bourne Shell                     4             13              0             34
-------------------------------------------------------------------------------
SUM:                           208           8156           4853          35148
-------------------------------------------------------------------------------

Repo: https://github.com/futurice/mibit

Clean compile

noah@Noahs-MacBook-Pro ~/d/m/frontend> time elm-make Main.elm --output /dev/null
Success! Compiled 137 modules.
Successfully generated /dev/null
       18.45 real        34.31 user        38.08 sys

Other info

noah@Noahs-MacBook-Pro ~/d/m/frontend> cloc .
     528 text files.
     514 unique files.
     187 files ignored.
github.com/AlDanial/cloc v 1.72  T=2.19 s (155.4 files/s, 23840.7 lines/s)

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Elm                            191           9355           7424          23007
JavaScript                      36           1132            264           6223
Sass                            22            204             12           2013
Markdown                        36            484              0           1155
JSON                            42              0              0            775
YAML                             6             17              0            124
Bourne Shell                     5             23              1             67
HTML                             2              2              1             36
Lisp                             1              0              0              2
-------------------------------------------------------------------------------
SUM:                           341          11217           7702          33402
-------------------------------------------------------------------------------
@mordrax
Copy link

mordrax commented Sep 14, 2017

SPA at work. I'm leading the frontend on this rewrite.

Builds

$ rm -rf elm-stuff/build-artifacts/
$ time sysconfcpus -n 1 elm make src/Main.elm --output /dev/null
Success! Compiled 349 modules.                                      
Successfully generated /dev/null

real	3m38.054s
user	3m34.868s
sys	0m3.492s


$ touch src/Main.elm 
$ time sysconfcpus -n 1 elm make src/Main.elm --output /dev/null
Success! Compiled 1 module.                                         
Successfully generated /dev/null

real	0m6.433s
user	0m6.048s
sys	0m0.376s

Typical incremental build

$ touch src/View/Quotation.elm 
$ time sysconfcpus -n 1 elm make src/Main.elm --output /dev/null
Success! Compiled 75 modules.                                       
Successfully generated /dev/null

real	2m24.808s
user	2m24.296s
sys	0m0.712s

Same build using the js hack

$ touch src/View/Quotation.elm 
$ time ./hack.sh src/View/Quotation.elm 
Processing file ./src/View/Quotation.elm
Success! Compiled 1 module.                                         
Successfully generated /dev/null
_user\$project\$View_Quotation\$  FIRSTLINE:57090  LASTLINE:58746  LASTFUNCTIONSIZE:28  LAST:58720

real	0m1.236s
user	0m1.640s
sys	0m0.932s

Files

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
JavaScript                       3           1311            231          80986
Elm                            289          10357           1030          34461
CSS                              8            349            236           4295
HTML                            14            321             29           2318
SASS                            14             34             34           1768
LESS                            14             34             44           1758
Markdown                         2              5              0             19
-------------------------------------------------------------------------------
SUM:                           344          12411           1604         125605
-------------------------------------------------------------------------------

System details

Memory: 8GB
Processor: Intel® Core™ i5-2500K CPU @ 3.30GHz × 4 
256gb SSD
Ubuntu 16.04 LTS

@joefiorini
Copy link

joefiorini commented Feb 13, 2018

Repo: https://github.com/joefiorini/flittal/tree/getting-running

just upgraded to 0.18 from 0.14.

Clean build

Including packages in case that helps.

⊕ time elm-make src/Main.elm --output /dev/null
Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-community/lazy-list 1.0.0
    elm-community/list-extra 7.1.0
    elm-community/random-extra 2.0.0
    elm-community/shrink 2.0.0
    elm-community/undo-redo 2.0.0
    elm-lang/core 5.1.1
    elm-lang/dom 1.1.1
    elm-lang/html 2.0.0
    elm-lang/keyboard 1.0.1
    elm-lang/lazy 2.0.0
    elm-lang/navigation 2.1.0
    elm-lang/virtual-dom 2.0.4
    evancz/elm-markdown 3.0.2
    ohanhi/keyboard-extra 3.0.4

Do you approve of this plan? [Y/n] y
Starting downloads...

  ● elm-community/lazy-list 1.0.0
  ● elm-community/shrink 2.0.0
  ● elm-community/random-extra 2.0.0
  ● elm-lang/core 5.1.1
  ● elm-lang/lazy 2.0.0
  ● evancz/elm-markdown 3.0.2
  ● elm-lang/keyboard 1.0.1
  ● elm-lang/dom 1.1.1
  ● elm-community/list-extra 7.1.0
  ● elm-community/undo-redo 2.0.0
  ● elm-lang/navigation 2.1.0
  ● elm-lang/html 2.0.0
  ● elm-lang/virtual-dom 2.0.4
  ● ohanhi/keyboard-extra
3.0.4
Packages configured successfully!
Success! Compiled 91 modules.
Successfully generated /dev/null
      263.97 real       273.47 user        17.09 sys

Other info

⊕ cloc src
      50 text files.
      50 unique files.
       4 files ignored.

github.com/AlDanial/cloc v 1.76  T=1.04 s (44.1 files/s, 3528.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Elm                             28            600            174           2200
Sass                            14             54              7            316
HTML                             1             41              0            166
JavaScript                       3             25              0             95
-------------------------------------------------------------------------------
SUM:                            46            720            181           2777
-------------------------------------------------------------------------------
⊕ elm-make src/Main.elm +RTS -s -RTS

Packages configured successfully!
Success! Compiled 91 modules.
Successfully generated index.html
 105,196,830,936 bytes allocated in the heap
   3,421,676,984 bytes copied during GC
      52,436,664 bytes maximum residency (255 sample(s))
       1,896,960 bytes maximum slop
             116 MB total memory in use (0 MB lost due to fragmentation)

                                     Tot time (elapsed)  Avg pause  Max pause
  Gen  0     201877 colls, 201877 par   34.077s  14.806s     0.0001s    0.0587s
  Gen  1       255 colls,   254 par    4.214s   1.462s     0.0057s    0.1438s

  Parallel GC work balance: 13.94% (serial 0%, perfect 100%)

  TASKS: 15 (1 bound, 14 peak workers (14 total), using -N4)

  SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

  INIT    time    0.000s  (  0.001s elapsed)
  MUT     time  242.428s  (251.092s elapsed)
  GC      time   38.291s  ( 16.269s elapsed)
  EXIT    time    0.001s  (  0.002s elapsed)
  Total   time  280.721s  (267.364s elapsed)

  Alloc rate    433,930,885 bytes per MUT second

  Productivity  86.4% of total user, 90.7% of total elapsed

gc_alloc_block_sync: 798392
whitehole_spin: 0
gen[0].sync: 420
gen[1].sync: 103944

@smucode
Copy link

smucode commented Apr 20, 2018

tl;dr

Types RTS Opts Compile time Artifacts size
Yes -A512M -H128M -n8m 3m7s 91M
Yes -s 6m14s 93M
No -A512M -H128M -n8m 1m22s 13M

For the last one I removed all type declarations apart from our main function. I also had to remove a few files as I kept running into an issue with the type inference algorithm of elm-make: Unable to generalize a type variable, it is unranked.

cloc

$ cloc .
     325 text files.
     324 unique files.                                          
      25 files ignored.

github.com/AlDanial/cloc v 1.76  T=1.05 s (284.6 files/s, 158321.8 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
JavaScript                       2              5              8         118011
Elm                            198           6549            708          22933
CSS                             16            372             80           6680
Sass                            55            743             66           5384
HTML                            12            351              2           2971
LESS                            17             61             67           1896
-------------------------------------------------------------------------------
SUM:                           300           8081            931         157875
-------------------------------------------------------------------------------

With +RTS -A512M -H128M -n8m -RTS, 3m7s, 91M build artifacts

$  rm -r elm-stuff && elm-package install --yes
Starting downloads...

  ● NoRedInk/elm-decode-pipeline 3.0.0
  ● Zinggi/elm-webgl-math 1.0.6
  ● alpacaaa/elm-date-distance 1.1.0
  ● Skinney/murmur3 2.0.6
  ● avh4/elm-fifo 1.0.3
  ● elm-community/dict-extra 2.3.0
  ● elm-community/intdict 2.1.0
  ● elm-community/graph 4.1.0
  ● elm-community/list-extra 6.1.0
  ● elm-community/string-extra 1.4.0
  ● elm-lang/animation-frame 1.0.1
  ● elm-lang/core 5.1.1
  ● elm-lang/http 1.0.0
  ● elm-lang/html 2.0.0
  ● elm-lang/dom 1.1.1
  ● elm-lang/mouse 1.0.1
  ● elm-lang/navigation 2.1.0
  ● elm-lang/svg 2.0.0
  ● elm-lang/virtual-dom 2.0.4
  ● elm-lang/trampoline 1.0.1
  ● elm-lang/window 1.0.1
  ● elm-tools/parser 2.0.1
  ● elm-tools/parser-primitives 1.0.0
  ● eskimoblood/elm-color-extra 5.1.0
  ● evancz/url-parser 2.0.1
  ● folkertdev/elm-deque 2.0.0
  ● folkertdev/one-true-path-experiment 3.0.2
  ● folkertdev/svg-path-lowlevel 1.0.1
  ● fredcy/elm-parseint 2.0.0
  ● justinmimbs/elm-date-extra 2.1.1
  ● klaftertief/elm-heatmap 1.0.0
  ● jweir/elm-iso8601 3.0.2
  ● krisajenkins/elm-exts 27.4.0
  ● krisajenkins/remotedata 4.4.0
  ● mdgriffith/elm-style-animation 3.5.5
  ● mgold/elm-geojson 2.0.0
  ● mdgriffith/style-elements 4.3.0
  ● opensolid/geometry 2.1.0
  ● gampleman/elm-visualization 1.6.1
  ● supermario/elm-countries 1.0.2
  ● rtfeldman/hex 1.0.0

Packages configured successfully!

$ time elm-make +RTS -A512M -H128M -n8m -RTS src/elm/Main.elm --output /dev/null
Success! Compiled 447 modules.                                      
Successfully generated /dev/null

real	3m7.904s
user	4m5.909s
sys	0m43.891s

$ du -h elm-stuff/build-artifacts/0.18.0/foo/bar/
 91M	elm-stuff/build-artifacts/0.18.0/foo/bar//1.0.0
 91M	elm-stuff/build-artifacts/0.18.0/foo/bar/

With +RTS -s -RTS, 6m14s , 93M build artifacts

$ rm -r elm-stuff && elm-package install --yes
Starting downloads...

# (same packages...)

Packages configured successfully!

$ time elm-make +RTS -s -RTS src/elm/Main.elm --output /dev/null
Success! Compiled 447 modules.                                      
Successfully generated /dev/null
 242,122,653,200 bytes allocated in the heap
 181,639,551,480 bytes copied during GC
     718,209,888 bytes maximum residency (1003 sample(s))
      20,109,768 bytes maximum slop
            1978 MB total memory in use (0 MB lost due to fragmentation)

                                     Tot time (elapsed)  Avg pause  Max pause
  Gen  0     461437 colls, 461436 par   944.174s  204.093s     0.0004s    0.0784s
  Gen  1      1003 colls,  1003 par   216.620s  36.564s     0.0365s    0.5996s

  Parallel GC work balance: 8.37% (serial 0%, perfect 100%)

  TASKS: 18 (1 bound, 17 peak workers (17 total), using -N8)

  SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

  INIT    time    0.001s  (  0.001s elapsed)
  MUT     time  213.269s  (133.163s elapsed)
  GC      time  1160.794s  (240.657s elapsed)
  EXIT    time    0.000s  (  0.000s elapsed)
  Total   time  1374.066s  (373.822s elapsed)

  Alloc rate    1,135,291,776 bytes per MUT second

  Productivity  15.5% of total user, 57.1% of total elapsed

gc_alloc_block_sync: 13854752
whitehole_spin: 0
gen[0].sync: 356
gen[1].sync: 9277665

real	6m14.021s
user	22m54.066s
sys	7m53.766s

$ du -h elm-stuff/build-artifacts/0.18.0/foo/bar/
 93M	elm-stuff/build-artifacts/0.18.0/foo/bar//1.0.0
 93M	elm-stuff/build-artifacts/0.18.0/foo/bar/

Types removed, with +RTS -A512M -H128M -n8m -RTS, 1m22s , 13M build artifacts

$  rm -r elm-stuff && elm-package install --yes
Starting downloads...

# (same packages...)

Packages configured successfully!

$ time elm-make +RTS -A512M -H128M -n8m -RTS src/elm/Main.elm --output /dev/null
Success! Compiled 443 modules.                                      
Successfully generated /dev/null

real	1m31.936s
user	1m22.255s
sys	0m11.761s

$ du -h elm-stuff/build-artifacts/0.18.0/foo/bar/
 13M	elm-stuff/build-artifacts/0.18.0/foo/bar//1.0.0
 13M	elm-stuff/build-artifacts/0.18.0/foo/bar/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment