About the performance of JavaScript and an alternative to the UXP platform

General project discussion.
Use this as a last resort if your topic does not fit in any of the other boards but it still on-topic.
Forum rules
This General Discussion board is meant for topics that are still relevant to Pale Moon, web browsers, browser tech, UXP applications, and related, but don't have a more fitting board available.

Please stick to the relevance of this forum here, which focuses on everything around the Pale Moon project and its user community. "Random" subjects don't belong here, and should be posted in the Off-Topic board.
User avatar
noobsoftware
Apollo supporter
Apollo supporter
Posts: 45
Joined: 2020-09-01, 15:19

About the performance of JavaScript and an alternative to the UXP platform

Unread post by noobsoftware » 2023-08-10, 15:03

I have made one application using UXP, called Noob Music and had much fun doing it, which i then decided to transform to an alternative form to make it viable to app stores. The first transition was from UXP to Xamarin.Forms, using a thing called a WebView which is essentially an embedded browser in an C# based application, i decided to use PHP for the backend of the application which is really nice because it is essentially similar to web development, using HTML, CSS and JavaScript for the front-end and PHP for the backend. Then i decided to try making my own JavaScript engine which i quickly learned would be to difficult a project, and ended up changing it to a PHP interpreter and engine, because the Xamarin.Forms platforms i was using was not working as well as expected with its latest incarnation (.net maui), so i ended up converting Noob Music to a native Objective-C based application using my own PHP-esq interpreter for the backend code. Now i have made two applications using my own PHP-like interpreter, using a WebView for the front end and php-like code for the backend, Noob Music and Noob Media Center, on windows they still use the peachpie version for the php code instead of my own version called NoobScript. I just wanted to present this idea for developers out there looking for a similar development method to UXP, each method obviously has its pros and cons, and i have been thinking about the possibility of introducing addons to my apps but have not gone through with it due to generally thinking it would be hard to get developers to participate.

The Objective-c version of my apps also includes a minimal layout engine for native elements, i have used it to mix in a VideoView with the WebView in the Media Center app which is very useful.

Here is the repo for NoobScript if anyone is interested: https://github.com/noobsoftware/NoobScript2 This repo also contains php-code from a mathematical program i have developed to test performance, and surprisingly PHP outperforms my version (NoobScript) by a huge scale. So i wonder if anyone here is interested in discussing what kind of optimizations are used in scripting languages which makes them so fast. In my experience JavaScript and PHP outperform languages such as C# and even Objective-c by a large factor. My original thoughts were that there are some kind of concurrency tricks used, but that can only help up to a point.

Also if anyone is interested in trying out noobscript and this minimal "platform" for making mac apps with this approach, it should be noted recursion only works up to about 300 sub calls and then fails, something which i have not yet found a solution for. If you want to contribute to noobscript and the Noob Mac app platform please let me know. NoobScript now supports async functions which run on threads, but seems to fail in the case of large number of callbacks. It runs the program that is contained in the resources folder properly but as i mentioned much slower then actual PHP. So it is only really useful for simple minimal backend code like fetching data. And for some reason string operations are incredibly slow and array should be used instead.

Comparing UXP and this approach has its pros and cons, i generally like UXP for the great benefit of addons and scriptability but it lacks support for app stores and does not have a large library support for external libraries such as Cocoapods for Objective-c and Nugets for C#, although i to my knowledge it is possible to embed c++ libraries somehow it just seems to complicate for me to learn . I am interested in continuing using both platforms (that is UXP and the WebView approach) in the future, just wanted to present this idea and to hope for some exchange of ideas. And my apps can be found on https://noob.software if anyone is interested in taking a look.

BenFenner
Astronaut
Astronaut
Posts: 588
Joined: 2015-06-01, 12:52
Location: US Southeast

Re: About the performance of JavaScript and an alternative to the UXP platform

Unread post by BenFenner » 2023-08-11, 16:16

noobsoftware wrote:
2023-08-10, 15:03
Here is the repo for NoobScript if anyone is interested: https://github.com/noobsoftware/NoobScript2
Link gives a 404 error.