Hacker News new | ask | show | jobs
by soylentgraham 1552 days ago
No-JIT only applies to script loaded from outside the app/bundle though, and you said yourself, you're only sending stuff back and forth, are you actually loading (remote) script at runtime (where you won't get JIT, but can still execute, like v8 on ios now)

Javascriptcore-on-device is debuggable too!

I personally use native javasriptcore on ios&mac, (which lets me get my engine+app down to under 10mb) javascriptcore (the open source one) for linux (and at one point windows, but I use chakra there). At one point I used v8 on windows & mac, but it's such a PITA to build into the form (dll/static) I want, I just had to give up in favour of native runtimes

There are some annoyances with the difference between apple jscore & open source jscore, but all fixable! (not sure it took me 3 months :)

https://github.com/NewChromantics/PopEngine

hackernews isnt the great for discussion, but if you ever want to chat more, just find my username on twitter/instagram/etc (I don't get to talk about this low level js stuff much, I think the number of people using it outside chromium is under 2 figures :)

1 comments

Oh, right, hello Graham! Now I recognize your name, which sounded familiar. When I was originally researching these topics, I found your great stuff and took lots of notes!

https://github.com/SimHacker/UnityJS/blob/master/notes/Oculu...

https://github.com/SimHacker/UnityJS/blob/master/notes/PInvo...

https://github.com/SimHacker/UnityJS/blob/master/notes/Skybo...

https://github.com/SimHacker/UnityJS/blob/master/notes/Unity...

https://github.com/SimHacker/UnityJS/blob/master/notes/Surfa...

https://github.com/SimHacker/UnityJS/blob/master/notes/ZeroC...

Now I recall that we even had an email discussion about how to render an Android WebView into a Unity texture and efficiently get GPU textures into Unity, relating to your UnityAndroidVideoTexture and popmovie plugin, back in December 2016 -- thanks for the great advice, and for open sourcing and sharing that code! That was some very tricky stuff to have to figure out on my own.

And of course every platform has its own weird tricky plumbing like that that (which changes over time). So UnityJS is intended to abstract that from the casual programmer, who only needs to deal with good old JavaScript, without mixing in C++, Java, C, and Objective C.

Another great source to learning the best way of doing tricky low level platform dependent plumbing things like that is the Chrome and Firefox browser source code. Much better than reading through old out-of-date blog postings that don't even apply any more. Those huge projects have extremely talented people from the respective companies working directly on them, who deeply know (or even implemented) all the latest poorly- or un-documented APIs.

Reading that code is like drinking from a firehose, and it can be overwhelming finding the actual four lines of magic code that does the tricky stuff, but you know it has to be in there somewhere, so don't give up!

A good way of figuring out where to start and finding a pointer into the right part of the monolithic source code is to look for related bugs and issues and pr's that discuss and point into the code, and search the bug database for names of important and unique API functions and symbols.

For example, here are some notes I took on Apple's "IOSurface", which is kind of like the Apple equivalent of Android GL_TEXTURE_EXTERNAL_OES textures:

https://github.com/SimHacker/UnityJS/blob/master/notes/IOSur...