[Ur] Improving JS VM (was: Re: Arrays and maps?)
Adam Chlipala
adamc at csail.mit.edu
Thu Aug 10 10:30:18 EDT 2017
On 07/24/2017 11:08 PM, Artyom Shalkhakov wrote:
> 2017-07-25 1:46 GMT+06:00 Aistis Raulinaitis <sheganinans at gmail.com>:
>> I agree, I think arrays are much overused in programming for the most part.
>> My thoughts on are that these libs should facilitate easier interop with the
>> existing JS libs rather than as a bedrock for a data structure on the
>> frontend. On the other hand, I like the idea of a finger tree
>> implementation. My only question is, since we have the choice, would it be
>> more appropriate to implement it using modules or type classes? My Haskell
>> background makes me lean in one direction, but I think it would be
>> interesting to have both. That being said, I should have the js array
>> library out in the next day or two. Mind you both of these libs in their
>> forEach functions call execF twice. So you are invoking the Ur/Web runtime
>> twice for each element. This shouldn't be too bad depending on the
>> calculation, but it's something to keep in mind.
>>
> Speaking of which, how is the VM implemented and are there any
> low-hanging fruits to improve it?
That is a tough question to give a short answer to! However, you can
find the whole implementation within urweb/lib/js/urweb.js. The whole
runtime system is there, but the file is an upper bound on VM
complexity. It's under 2000 lines of code.
I haven't heard anyone complain about performance of client-side Ur/Web
code in years, as far as I can remember, so it's not clear there are any
high-priority issues on that front.
More information about the Ur
mailing list