purescript-language-cst-parser icon indicating copy to clipboard operation
purescript-language-cst-parser copied to clipboard

feat: update to spago@next

Open srghma opened this issue 11 months ago • 5 comments

 ~/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.

srghma avatar Mar 17 '24 04:03 srghma

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

natefaubion avatar Mar 17 '24 14:03 natefaubion

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?

srghma avatar Mar 18 '24 01:03 srghma

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 avatar Mar 18 '24 01:03 natefaubion

https://github.com/natefaubion/purescript-language-cst-parser/blob/67323ef7038ee6514c1912684398e3da5a3fd207/bench/ParseFile.purs#L63-L69

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.

natefaubion avatar Mar 18 '24 02:03 natefaubion

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.

srghma avatar Mar 18 '24 07:03 srghma