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

System IO refactor #48

Merged
merged 12 commits into from
Dec 8, 2024
Merged

System IO refactor #48

merged 12 commits into from
Dec 8, 2024

Conversation

decioferreira
Copy link

@decioferreira decioferreira commented Dec 7, 2024

The main change here revolved around the re-implementation of the IO monad, allowing for the removal of the need for the top level decoder.

As part of this work we had to move some of the data structures from modules like Compiler.Type.UnionFind, Compiler.Type.Type and Compiler.Elm.ModuleName into the IO monad modules, so that we can have them directly referred on the RealWorld record (before we had to use Decode.Value because otherwise we would create import cycles).

This also:

The improvement on performance was the following (from ~56:58.46 to ~2:28.32):

Before:

% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm 
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/json 1.1.3
  ● pilatch/flip 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/regex 1.0.0
  ● elm/random 1.0.0
  ● elm/bytes 1.0.8
  ● fredcy/elm-parseint 2.0.1
  ● dasch/levenshtein 1.0.3
  ● rtfeldman/elm-hex 1.0.0
  ● elm/parser 1.1.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● elm-community/basics-extra 4.1.0
  ● elm/url 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/list-extra 8.7.0
  ● elm-community/maybe-extra 5.3.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm/core 1.0.5
  ● zwilias/elm-rosetree 1.5.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● elm/html 1.0.0
  ● elm-explorations/test 2.2.0

Dependencies ready!           
Success! Compiled 132 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  3666.89s user 249.74s system 114% cpu 56:58.46 total

After:

% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/bytes 1.0.8
  ● elm/regex 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/random 1.0.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● rtfeldman/elm-hex 1.0.0
  ● fredcy/elm-parseint 2.0.1
  ● elm/html 1.0.0
  ● elm/json 1.1.3
  ● dasch/levenshtein 1.0.3
  ● elm-community/list-extra 8.7.0
  ● elm/url 1.0.0
  ● elm/core 1.0.5
  ● pilatch/flip 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/basics-extra 4.1.0
  ● elm-community/maybe-extra 5.3.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● zwilias/elm-rosetree 1.5.0
  ● elm/parser 1.1.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm-explorations/test 2.2.0

Dependencies ready!           
Success! Compiled 141 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  157.99s user 2.57s system 108% cpu 2:28.32 total

@decioferreira decioferreira merged commit 87be0b2 into master Dec 8, 2024
2 checks passed
@decioferreira decioferreira deleted the system-io branch December 8, 2024 11:34
decioferreira added a commit that referenced this pull request Dec 8, 2024
The main change here revolved around the re-implementation of the IO
monad, allowing for the removal of the need for the top level decoder.

As part of this work we had to move some of the data structures from
modules like `Compiler.Type.UnionFind`, `Compiler.Type.Type` and
`Compiler.Elm.ModuleName` into the IO monad modules, so that we can have
them directly referred on the `RealWorld` record (before we had to use
`Decode.Value` because otherwise we would create import cycles).

This also:
- seems to have solved #33
- partially addresses #10
- greatly improved performance (relates to #37)

The improvement on performance was the following (from `~56:58.46` to
`~2:28.32`):

Before:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/json 1.1.3
  ● pilatch/flip 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/regex 1.0.0
  ● elm/random 1.0.0
  ● elm/bytes 1.0.8
  ● fredcy/elm-parseint 2.0.1
  ● dasch/levenshtein 1.0.3
  ● rtfeldman/elm-hex 1.0.0
  ● elm/parser 1.1.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● elm-community/basics-extra 4.1.0
  ● elm/url 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/list-extra 8.7.0
  ● elm-community/maybe-extra 5.3.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm/core 1.0.5
  ● zwilias/elm-rosetree 1.5.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● elm/html 1.0.0
  ● elm-explorations/test 2.2.0

Dependencies ready!
Success! Compiled 132 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  3666.89s user 249.74s system 114% cpu 56:58.46 total
```

After:
```
% time guida make --optimize --output=bin/guida.js src/Terminal/Main.elm
Starting downloads...

  ● andre-dietrich/parser-combinators 4.1.0
  ● elm/time 1.0.0
  ● elm/bytes 1.0.8
  ● elm/regex 1.0.0
  ● elm/virtual-dom 1.0.3
  ● elm/random 1.0.0
  ● the-sett/elm-pretty-printer 3.1.0
  ● rtfeldman/elm-hex 1.0.0
  ● fredcy/elm-parseint 2.0.1
  ● elm/html 1.0.0
  ● elm/json 1.1.3
  ● dasch/levenshtein 1.0.3
  ● elm-community/list-extra 8.7.0
  ● elm/url 1.0.0
  ● elm/core 1.0.5
  ● pilatch/flip 1.0.0
  ● elm-community/array-extra 2.6.0
  ● elm-community/basics-extra 4.1.0
  ● elm-community/maybe-extra 5.3.0
  ● guida-lang/graph 1.0.0
  ● guida-lang/glsl 1.0.0
  ● zwilias/elm-rosetree 1.5.0
  ● elm/parser 1.1.0
  ● obiloud/numeric-decimal 3.0.1
  ● elm-explorations/test 2.2.0

Dependencies ready!
Success! Compiled 141 modules.

    Terminal.Main ───> bin/guida.js

guida make --optimize --output=bin/guida.js src/Terminal/Main.elm  157.99s user 2.57s system 108% cpu 2:28.32 total
```
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

Successfully merging this pull request may close these issues.

1 participant