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

feat: update to spago@next #57

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

feat: update to spago@next #57

wants to merge 7 commits into from

Conversation

srghma
Copy link

@srghma srghma commented Mar 17, 2024

 ~/projects/purescript-language-cst-parser   main ±✚  npm run parse-package-set

> parse-package-set
> spago run --package parse-package-set

Reading Spago workspace configuration...

✅ Selecting package to build: parse-package-set

Downloading dependencies...
Building...
           Src   Lib   All
Warnings     0     0     0
Errors       0     0     0

✅ Build succeeded.

Making new project in /tmp/cst-integration-5IqNY6
Successfully parsed 3654 of 3654 modules.

---- [ Success Case Timing Information ] ----
Fastest Parse Times:
     0.044ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Interaction/Voronoi.purs
     0.049ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Layout/XYChart.purs
     0.050ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Util/Data/Point.purs
     0.052ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPUCommandBuffer.purs
     0.054ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Interaction/Drag.purs
     0.056ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Marker.purs
     0.057ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Layout/Chord.purs
     0.067ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPUComputePipeline.purs
     0.068ms  /tmp/cst-integration-5IqNY6/.spago/p/milkis-9.0.0/src/Milkis.Impl.purs
     0.073ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPUSampler.purs
     0.076ms  /tmp/cst-integration-5IqNY6/.spago/p/visx-0.0.2/src/VISX/Util/Data/Bounds.purs
     0.077ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPUBindGroup.purs
     0.077ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPURenderPipeline.purs
     0.078ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPUBindGroupLayout.purs
     0.085ms  /tmp/cst-integration-5IqNY6/.spago/p/milkis-9.0.0/src/Milkis.Impl.Window.purs
     0.085ms  /tmp/cst-integration-5IqNY6/.spago/p/rito-0.3.4/src/Rito/WireframeLinejoin.purs
     0.087ms  /tmp/cst-integration-5IqNY6/.spago/p/react-basic-dnd-10.1.0/src/React/Basic/ReactDND/Backends/TouchBackend.purs
     0.090ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPURenderBundle.purs
     0.092ms  /tmp/cst-integration-5IqNY6/.spago/p/webgpu-0.0.1/src/Web/GPU/GPUTextureView.purs
     0.096ms  /tmp/cst-integration-5IqNY6/.spago/p/web-pointerevents-2.0.0/src/Web/PointerEvent.purs

Slowest Parse Times:
   566.388ms  /tmp/cst-integration-5IqNY6/.spago/p/unicode-6.0.0/src/Data/CodePoint/Unicode/Internal.purs
   469.761ms  /tmp/cst-integration-5IqNY6/.spago/p/react-basic-dom-6.1.0/src/React/Basic/DOM/Generated.purs
   386.983ms  /tmp/cst-integration-5IqNY6/.spago/p/unicode-6.0.0/src/Data/CodePoint/Unicode/Internal/Casing.purs
   369.719ms  /tmp/cst-integration-5IqNY6/.spago/p/react-basic-dom-6.1.0/src/React/Basic/DOM/Simplified/Generated.purs
   284.916ms  /tmp/cst-integration-5IqNY6/.spago/p/elmish-html-0.8.2/src/Elmish/HTML/Generated.purs
   221.206ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/TablerIcons.purs
   217.417ms  /tmp/cst-integration-5IqNY6/.spago/p/tecton-0.2.1/src/Tecton/Internal.purs
   203.903ms  /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Pi.purs
   135.062ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/Primer.purs
   131.513ms  /tmp/cst-integration-5IqNY6/.spago/p/react-basic-dom-6.1.0/src/React/Basic/DOM/SVG.purs
   128.941ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/RemixIcon.purs
   126.082ms  /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Tb.purs
   121.459ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/FontAwesome.purs
   119.107ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/BoxIcons.purs
   116.178ms  /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Md.purs
   105.299ms  /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Gi.purs
   102.597ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/Bootstrap.purs
   102.173ms  /tmp/cst-integration-5IqNY6/.spago/p/halogen-bootstrap5-5.3.2/src/Halogen/Themes/Bootstrap5.purs
    97.540ms  /tmp/cst-integration-5IqNY6/.spago/p/css-frameworks-1.0.1/src/CSSFrameworks/BootstrapIcons.purs
    76.248ms  /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs

Mean Parse: 4.884ms
Successfully printed 3654 of 3654 successully parsed modules.
Successfully sorted module graph for 3654 of 3654  successfully parsed modules.
 ~/projects/purescript-language-cst-parser   main ✚  npm run bench-file /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs

> bench-file
> spago build --package bench && node --expose-gc --input-type="module" -e "import { main } from './output/BenchFile/index.js';main()" /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs

Reading Spago workspace configuration...

✅ Selecting package to build: bench

Downloading dependencies...
Building...
           Src   Lib   All
Warnings     0     0     0
Errors       0     0     0

✅ Build succeeded.

Benchmarking /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs
mean   = 58.79 ms
stddev = 9.02 ms
min    = 51.63 ms
max    = 114.40 ms
 ~/projects/purescript-language-cst-parser   main ±✚  npm run parse-file -- /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs --tokens

> parse-file
> spago build --package bench && node --input-type="module" -e "import { main } from './output/ParseFile/index.js';main()" /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs --tokens

Reading Spago workspace configuration...

✅ Selecting package to build: bench

Downloading dependencies...
Building...
           Src   Lib   All
Warnings     0     0     0
Errors       0     0     0

✅ Build succeeded.

file:///home/srghma/projects/purescript-language-cst-parser/output/Effect.Aff/foreign.js:530
                throw util.fromLeft(step);
                ^

RangeError: Maximum call stack size exceeded
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:150:25
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:240:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:584:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:643:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:646:32
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:240:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:584:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:584:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:1023:34
    at file:///home/srghma/projects/purescript-language-cst-parser/output/Data.Lazy/foreign.js:6:9

Node.js v21.0.0
 ✘  ~/projects/purescript-language-cst-parser   main ±✚  npm run parse-file -- /tmp/cst-integration-5IqNY6/.spago/p/milkis-9.0.0/src/Milkis.Impl.purs --tokens

> parse-file
> spago build --package bench && node --input-type="module" -e "import { main } from './output/ParseFile/index.js';main()" /tmp/cst-integration-5IqNY6/.spago/p/milkis-9.0.0/src/Milkis.Impl.purs --tokens

Reading Spago workspace configuration...

✅ Selecting package to build: bench

Downloading dependencies...
Building...
           Src   Lib   All
Warnings     0     0     0
Errors       0     0     0

✅ Build succeeded.

module Milkis.Impl
  ( FetchImpl
  )
  where{

foreign import data FetchImpl :: Type}
Parse succeeded.

parse-package-set/src/Main.purs Outdated Show resolved Hide resolved
parse-package-set/src/Main.purs Outdated Show resolved Hide resolved
@natefaubion
Copy link
Owner

What's going on with the stack overflow in your output?

@srghma
Copy link
Author

srghma commented Mar 18, 2024

What's going on with the stack overflow in your output?

the file /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs is too big

  • npm run parse-file -- /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs --tokens fails - this file is from Slowest Parse Times:

  • npm run parse-file -- /tmp/cst-integration-5IqNY6/.spago/p/milkis-9.0.0/src/Milkis.Impl.purs --tokens works fine - this file is from Fastest Parse Times:

You think it was caused by update?

@natefaubion
Copy link
Owner

I didn't notice the --tokens flag. As long as a full parse works OK, then I'm going to assume that the --tokens bench is naive in some way.

@natefaubion
Copy link
Owner

go acc = step >>> case _ of
TokenEOF _ _ ->
Right acc
TokenError _ err _ _ ->
Left err
TokenCons tok _ next _ ->
go (Array.snoc acc tok) next

Yeah, because of the step >>> ... part, the main compiler no longer sees this as tail recursive, so it doesn't generate a loop and it stack overflows.

s <- liftEffect $ Buffer.toString UTF8 =<< Exec.execSync' "spago ls packages --json" (_ { cwd = Just tmpPath })
packages <- case decodeJson =<< parseJson s of
Left err -> throwError $ error $ printJsonDecodeError err
Right (object :: Object Json) -> pure $ Object.keys object
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
Right (object :: Object Json) -> pure $ Object.keys object
Right object -> pure $ Object.keys object

Copy link
Author

Choose a reason for hiding this comment

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

it will throw error Object a0 is wrong type

@srghma
Copy link
Author

srghma commented Mar 18, 2024

I didn't notice the --tokens flag. As long as a full parse works OK, then I'm going to assume that the --tokens bench is naive in some way.

yes, works

 ~/projects/purescript-language-cst-parser   main  npm run parse-file -- /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs --tokens

> parse-file
> spago build --package bench && node --input-type="module" -e "import { main } from './output/ParseFile/index.js';main()" /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs --tokens

Reading Spago workspace configuration...

✅ Selecting package to build: bench

Downloading dependencies...
Building...
           Src   Lib   All
Warnings     0     0     0
Errors       0     0     0

✅ Build succeeded.

file:///home/srghma/projects/purescript-language-cst-parser/output/Effect.Aff/foreign.js:530
                throw util.fromLeft(step);
                ^

RangeError: Maximum call stack size exceeded
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:150:25
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:240:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:584:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:643:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:646:32
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:240:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:584:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:584:26
    at file:///home/srghma/projects/purescript-language-cst-parser/output/PureScript.CST.Lexer/index.js:1023:34
    at file:///home/srghma/projects/purescript-language-cst-parser/output/Data.Lazy/foreign.js:6:9

Node.js v21.0.0
 ✘  ~/projects/purescript-language-cst-parser   main  npm run parse-file -- /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs

> parse-file
> spago build --package bench && node --input-type="module" -e "import { main } from './output/ParseFile/index.js';main()" /tmp/cst-integration-5IqNY6/.spago/p/react-icons-1.1.4/src/React/Icons/Bs.purs

Reading Spago workspace configuration...

✅ Selecting package to build: bench

Downloading dependencies...
Building...
           Src   Lib   All
Warnings     0     0     0
Errors       0     0     0

✅ Build succeeded.

Parse succeeded.

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.

2 participants