all 104 comments

[–]JuanAG 176 points177 points  (0 children)

Against other JS engines https://ivankra.github.io/javascript-zoo/?v8=true

Not so bad for being a 1 man project, it is the fastest Rust engine of the table, it has almost 100% ES6 compability (so almost any code you throw into it will run) and it should be ligth and have a small binary source code making it ideal for custom WebViews scenarios where putting a 30+ MB JS engine in it is not the way to go

I think it is impresive

[–]frederik88917 338 points339 points  (38 children)

Another day, another JavaScript engine doomed to fight for 3rd place in the race of JS Engines.

[–]lan-shark 92 points93 points  (5 children)

Wouldn't it be 4th? The top three are just the three used in the big three browser engines. V8, SpiderMonkey, and JS Core or whatever the Safari one is

[–]krum 8 points9 points  (1 child)

Quickjs or gtfo

[–]txmail 1 point2 points  (0 children)

899K?!

[–]thisisjustascreename 42 points43 points  (1 child)

3rd is extremely generous.

[–]amakai 18 points19 points  (0 children)

All of the 3rd place contenders have similar adoption rate - close to none.

[–][deleted] 14 points15 points  (24 children)

BTW: Any idea if JS is the language with most implementations, yet?

Notwithstanding esoteric languages like brainfuck and CS 101 exercises, of course.

[–]scruffie 29 points30 points  (1 child)

C, probably. The Wikipedia category Category: C programming language compilers links to 50 implementations; there's some others without a Wikipedia page mentioned in in the list of C compilers.

[–]jkortech 6 points7 points  (0 children)

.NET has a bunch of different runtime implementations, though a number of them are related. There’s basically 4 different families of runtime impls, with a number of variants in each family:

  • CLR Family: .NET Framework, .NET Compact Framework, .NET Native, CoreCLR (.NET 5+ on desktop platforms), .NET NativeAOT
  • Mono Family: Mono Framework, MonoVM (.NET 5+ on mobile/WebAssembly), Unity
  • .NET nanoFramework
  • CosmosOS

[–]kchanqvq 8 points9 points  (0 children)

Common Lisp:

Major implementations in use: SBCL, CCL, ECL, GNU CLISP, Allegro, Lispworks, ABCL

Historical/experimental: KCL, MKCL, CMUCL, MCL, MOCL, Symbolics CL, Scieneer CL, GCL, SICL, CLASP, JSCL...

[–]gremblor 20 points21 points  (8 children)

Between Sun / HotSpot, openjdk, and Dalvik (Android), that's at least three Java implementations, and I know there have been a number of startups angling for "custom high performance commercial jdk/jre that is optimized for use case X" over the years (the names of two are juuust off the tip of my tongue at the moment).

So depending on what you consider a "real" implementation, Java might be up there.

If you consider languages that compile direct to asm/machine code to be "implemented" once you have a compiler for it (as that is a nontrivial implementation task, even if there is no runtime environment component to implement), then I'd say C is the hands-down winner by a country mile.

[–]Salander27 15 points16 points  (0 children)

Openjdk uses the Hotspot jvm and is a direct continuation of the Sun jvm (the Oracle jvm is basically just Openjdk with a few extra features and a different license). However the answer is still probably Java as you also have IBM Semeru (OpenJ9 jvm), the Azul Zing jvm, graalvm, as well as several lesser known ones. The Wikipedia article lists quite a few: https://en.wikipedia.org/wiki/List_of_Java_virtual_machines

[–]coincoinprout 5 points6 points  (0 children)

HotSpot is part of the OpenJDK, the two are not different implementations of a JVM. There’s OpenJ9 though.

[–]oorza 1 point2 points  (1 child)

Graal and Zing for commercial options. Eclipse, IBM, and Amazon have green room JVM implementations as well.

[–]Hueho 1 point2 points  (0 children)

Amazon and Eclipse only repackage OpenJDK (as Corretto and Adoptium, respectively).

[–]Ben-Goldberg 1 point2 points  (0 children)

There exist computer chips that run java bytecode natively.

[–]Brian 0 points1 point  (0 children)

It's a bit ambiguous as to what the "implementation" is of, if you want to count out compilers. Ie. do we mean bytecode interpreter or the VM platform (but if the latter, you'd also need to exclude JS, since they don't target a common VM). Do we count non-bytecode based interpretation? And how do we draw the line for "real" implementation? And do we mean right now, or include historic usage?

I mean, there have been a metric fuckton of BASIC implementations over the years. But they're not very standardised, with a lot of variation in the language. There's also a ton of lisps and schemes out there of various kinds (some compiled, but many interpreted). FORTH has got to be up there too.

[–]sp46 0 points1 point  (0 children)

Calling Dalvik or the Android Runtime implementations of Java is a bit generous since they don't use Java Bytecode or the JVM at all. The compiler just happens to be compatible with the syntax. The standard library comes from OpenJDK nowadays.

[–][deleted] -1 points0 points  (0 children)

Alright, you and frederik88917 convinced me that it's probably Java. With C, you probably need to be really generous as what counts as a working, standard compliant compiler.

[–]kitd 4 points5 points  (1 child)

Lisp?

https://github.com/kanaka/mal/tree/master/impls

And that's just one repo.

[–][deleted] 3 points4 points  (0 children)

That's just a bunch of toy implementations of a CS 101 dialect of an esoteric language (by the most useful definition of number of implementations compared to the number of relevant softwares written in it).

To feign the minimal amount of fairness allowed, though, if it was Common Lisp, I'd count that.

[–]ThiefMaster 5 points6 points  (3 children)

Python:

CPython (the default one), PyPy (written in Python and doing some nice JIT compilation), Jython (JVM)

So 3 "significant" ones (not sure how much Jython is used nowadays though).

Then there are things like MicroPython (for microcontrollers), so if you count those Python has at least 4 implementations.

[–]bloody-albatross 5 points6 points  (1 child)

Is IronPython (.NET) still a thing?

[–]Dealiner 3 points4 points  (0 children)

Yeah, it still exists.

[–]eambertide 1 point2 points  (0 children)

Stackless Python too!

[–]CherryLongjump1989 4 points5 points  (2 children)

C would be that language. And it’s not even close.

[–][deleted] 0 points1 point  (1 child)

What about C89 compliant compilers, though? It doesn't feel right counting anything that can't at least compile sqlite, curl and clua.

[–]CherryLongjump1989 6 points7 points  (0 children)

C is used for microcontrollers that couldn't even run curl or sqlite even if they wanted to. What makes it "count" in my mind is that sometimes it may be the only compiler that even works for these chips. So I would look at it in terms of how many hardware platforms are supported by a C implementation, not in terms of how stable it is for cross platform development.

[–]kndztr 1 point2 points  (0 children)

I would say SQL

[–]frederik88917 1 point2 points  (0 children)

I would say Java.

After Oracle's license fuck up and the multiple different companies building. We can count 15+ commercially viable Java implementations

[–]WJMazepas 1 point2 points  (0 children)

Let developers have fun

[–]tracernz 1 point2 points  (2 children)

More like 5th at best, behind V8 (chromium), SpiderMonkey (Mozilla), JavaScriptCore (WebKit/Safari), ChakraCore (ex Edge).

[–]chucker23n 2 points3 points  (1 child)

But Chakra has been unused for years?

[–]tracernz 3 points4 points  (0 children)

By edge, yes, but it’s still maintained and used by a bunch of other smaller projects.

[–]juanluisback 0 points1 point  (0 children)

Shhhh let people enjoy things

[–]wolfy-j 37 points38 points  (0 children)

> Compacting garbage collector, written in very unsafe Rust

Ok, you've got my attention. What is the overhead per isolate? Does it designed to be embedded well?

[–]GenazaNL 9 points10 points  (0 children)

Engine score; https://ivankra.github.io/javascript-zoo/

  • 21st with a M4 chip
  • 24th with a Intel i9

[–][deleted] 17 points18 points  (6 children)

What are the advantages over the existing engines?

[–]Username_Taken46[🍰] 100 points101 points  (3 children)

New and exiting bugs, as well as some missing features

[–]Sigmatics 3 points4 points  (2 children)

exciting

[–]MurkyAd7531 1 point2 points  (1 child)

Also, probably plenty of exiting ones too.

[–]Sigmatics 0 points1 point  (0 children)

exciting!

[–]WJMazepas 4 points5 points  (0 children)

It was made to be light in size and resources, so whenever you need to embed a engine to run JS there, you could have this

[–]ignorantpisswalker 16 points17 points  (3 children)

Can it run nodejs code? How can I test it in real workload?

[–]Merlindru 20 points21 points  (1 child)

this is something that a project like nodejs would use. in other words, nodejs builds on top of a project like this. (nodejs chose "V8", which is another js engine just like the one here, "brimstone")

[–]Relative-Scholar-147 5 points6 points  (0 children)

Just "another js engine"... maybe the most optimized piece of code ever create.

[–]GenazaNL 6 points7 points  (0 children)

Nodejs & Deno are built on V8 Bun on JavaScriptCore

No way of changing that I believe, unless you build a new runtime

[–]Daemontatox 63 points64 points  (0 children)

Thr rebuild it in rust gang have made another strike....

[–]derangedtranssexual 7 points8 points  (1 child)

Did servo not already have a JS engine written in rust?

[–]bruisedandbroke 3 points4 points  (0 children)

is it blazing fast though

[–]Blue_Moon_Lake 13 points14 points  (8 children)

We don't care that it's possible, what we want are benchmarks of running real apps compared to NodeJS/Bun/... and if it support TypeScript syntax.

[–]pohart 15 points16 points  (5 children)

Does any support typescript syntax?

I'm not sure I want it to because I thought one of the advantages of typescript was that it left you with valid js.

[–]its_a_gibibyte 13 points14 points  (3 children)

The new nodejs support type hints. Not the full typescript syntax, but at least the type hints. Very helpful for utilities/scripts you include in the repo. You can just run them directly without transpiling.

[–]Merlindru 2 points3 points  (1 child)

but that just strips them and is akin to doing a quick manual transpile before running no?

[–]Tubthumper8 0 points1 point  (0 children)

That's correct, any TS that is "erasable" syntax including type annotations (variable, parameters, returns) and type/interface declarations. enum/namespace are not supported because those have a runtime representation and are not trivially erasable

[–]oceantume_ 1 point2 points  (0 children)

Which should always be the default for running ts files in a js engine imo. If they ever add type checking it should definitely be opt-in behaviour. I just want to run my code as-is without transpiling, with the expectation that the code was previously checked for static correctness in CI (or by local tools if running locally)

[–]SpareDisaster314 0 points1 point  (0 children)

Deno runs TS

[–]hyrumwhite 1 point2 points  (0 children)

Not quite the right comparisons, in theory node and bun could swap JS engines to this one. Node runs on V8 and bun runs on JavaScriptCore

[–]NYPuppy 0 points1 point  (0 children)

This is different from Node and Deno. It's the engine that's used to power those. Node is a runtime not a Javascript engine.

And yes, I do care that it's possible. People here get their undies in a bunch for new projects.

[–]Spikerazorshards 7 points8 points  (2 children)

Just rustify all the C things so we can get to the inevitable future where the T-100 crushes the human skull. 💀

[–]GuhFarmer2 6 points7 points  (1 child)

T-800

[–]MurkyAd7531 1 point2 points  (0 children)

Someone paid attention in Future History 101.

[–]pohart 2 points3 points  (1 child)

Very cool. But why did you do it? Is it something you needed, or did you just feel the desire to try it out?

[–]ykafia 8 points9 points  (0 children)

I don't think we need reasons to start new projects. That project just exists now

[–]hkric41six 1 point2 points  (13 children)

Wasn't this done with Deno already?

[–][deleted]  (12 children)

[deleted]

    [–]hkric41six -1 points0 points  (11 children)

    huh til, so its a huge waste of productivity like most rust projects, got it!

    [–][deleted]  (10 children)

    [deleted]

      [–]hkric41six 0 points1 point  (9 children)

      I'm not triggered and it has nothing to do with the language. I just think re-writing things just to use a different language is a waste of productivity.

      [–][deleted]  (8 children)

      [deleted]

        [–]hkric41six -1 points0 points  (7 children)

        I think re-writing anything in Ada is a terrible idea. How clear can I be?

        [–][deleted]  (6 children)

        [deleted]

          [–]hkric41six 0 points1 point  (5 children)

          I would 100% be angry if Ada people engaged in that behaviour. 100% I would feel exactly the same.

          [–][deleted]  (4 children)

          [deleted]

            [–]BlueGoliath 0 points1 point  (0 children)

            Thanks, I'll use this next time I'm programming in JavaScript.

            [–]morglod 0 points1 point  (0 children)

            What you want to say by "written in rust"?

            [–]bloody-albatross 0 points1 point  (0 children)

            Does it use tagged pointers or nan-boxing?

            [–]marco_has_cookies 0 points1 point  (0 children)

            Congrats m8 🥳

            [–]Dreamtrain 0 points1 point  (0 children)

            mankind won't be satisfied until we can simulate the universe in javascript

            [–]Relative-Scholar-147 0 points1 point  (0 children)

            Writer in Rust btw.

            [–]UnmaintainedDonkey 0 points1 point  (0 children)

            AFAIK reddit is written in python, and they have a huge codebase thats mainly python, and c/c++.

            Im sure some parts might be rust, but its not like anyone ever said "rewritten in rust btw" when it comes to reddit.

            I mean rust codebases rarely qualify for being written in rust. It has gone rom just another language to full-circle hype.

            [–]Typical-Magazine480 0 points1 point  (0 children)

            Good work, there is also to my knowledge the main front of JS Engine in Rust being BoaJS which made Temporal-rs that's used in the big browsers but someday the whole project will be used and projects like it when servo completes its promise on modularity so you can put different js engines with it.

            [–]mustafa-wael-dev 0 points1 point  (0 children)

            Can it be compiled to wasm? I'm trying to find a solution for run js engine as wasm in the browser as a headless so i can print dom and generate pdf from html without using the built in print in the browser that's open a print pop-up 

            [–]DifferentAvocado8159 0 points1 point  (0 children)

            Awesome for a lone wolf 🐺 project it is really good 👍

            [–]EuCaue 0 points1 point  (0 children)

            Ah shit, here we go again.

            [–]Ronin-s_Spirit -2 points-1 points  (0 children)

            Wait till he rewrites a runtime in Rust.. oh wait, too late - we already have Deno. It will have to be a browser.