haskman, to javascript
@haskman@functional.cafe avatar

Since the backend post (https://www.moonbitlang.com/blog/js-support) is trending, I thought I'd compare backend optimizer (https://github.com/aristanetworks/purescript-backend-optimizer) output to see how it fares. The results were pretty good!

With basically this PureScript code -

run = fromArray  
 >>> flatMapF (fromArray <<< _.members)  
 >>> filterF _.gender  
 >>> mapF (\x -> min 100 (x.score + 5))  
 >>> mapF grade  
 >>> filterF (_ == 'A')  
 >>> foldF (\_ x -> x+1) 0  

the benchmark results are as follows. PureScript is roughly 6x faster than plain JS, and 6x slower than Moonbit output ( -

┌─────────┬──────────────┬─────────────┬────────────────────┬──────────┬─────────┐  
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │  
├─────────┼──────────────┼─────────────┼────────────────────┼──────────┼─────────┤  
│ 0 │ 'Moonbit' │ '34,67,542' │ 288.38869989829305 │ '±0.06%' │ 1733772 │  
│ 1 │ 'Plain Js' │ '74,816' │ 13365.983827421464 │ '±0.54%' │ 37409 │  
│ 2 │ 'Kotlin Js' │ '1,90,241' │ 5256.474017304151 │ '±0.38%' │ 95121 │  
│ 3 │ 'PureScript' │ '4,99,456' │ 2002.1768597161156 │ '±0.70%' │ 249729 │  
└─────────┴──────────────┴─────────────┴────────────────────┴──────────┴─────────┘  

halfbit_, to cpp

seems like another worth keeping a eye on. I am still hoping for a more sane successor than , and I’m sad that because rust gets all the hype, great languages like don’t get the love they deserve. https://moonbitlang.com/blog/first-announce/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • kavyap
  • thenastyranch
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • cisconetworking
  • slotface
  • vwfavf
  • everett
  • Durango
  • rosin
  • tester
  • GTA5RPClips
  • khanakhh
  • osvaldo12
  • ngwrru68w68
  • normalnudes
  • anitta
  • ethstaker
  • cubers
  • modclub
  • tacticalgear
  • provamag3
  • Leos
  • JUstTest
  • All magazines