ghcjs / jsaddle

JavaScript interface that works with GHCJS or GHC
116 stars 62 forks source link

jsaddle-warp performance with massive arrays (length == 518400) #134

Open augyg opened 1 year ago

augyg commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_manipulation

I am currently trying to recreate this tutorial in jsaddle-warp (via obelisk ~~> reflex) and have the line

data' :: Maybe [Int] <- fromJSVal =<< frame ^. js "data" -- frame.data :: Array liftIO $ print data'

And this works beautifully when compiled with GHCJS but takes over 5 minutes and destroys the entire DOM on jsaddle-warp. **Is there some way to work with massive arrays that is performant on all runners?

I know I could I just do an eval statement but would mainly just like to know the best way to work with massive arrays (this being of length 518400). I also noticed that there isn't a method to update an Array A, at index I.

NOTE: a simple shrug that I'm on my own here would suffice, but hey might as well ask.