TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Porffor: A from-scratch experimental ahead-of-time JS engine

477 pointsby bpierre10 months ago

22 comments

awesomekling10 months ago
Oliver (the main developer) just announced that they’re going to work full time on Porffor: <a href="https:&#x2F;&#x2F;x.com&#x2F;canadahonk&#x2F;status&#x2F;1818347311417938237" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;canadahonk&#x2F;status&#x2F;1818347311417938237</a>
评论 #41113800 未加载
obviouslynotme10 months ago
I have thought about doing this and I just can&#x27;t get around the fact that you can&#x27;t get much better performance in JS. The best you could probably do is transpile the JS into V8 C++ calls.<p>The really cool optimizations come from compiling TypeScript, or something close to it. You could use types to get enormous gains. Anything without typing gets the default slow JS calls. Interfaces can get reduced to vtables or maybe even straight calls, possibly on structs instead of maps. You could have an Int and Float type that degrade into Number that just sit inside registers.<p>The main problem is that both TS and V8 are fast-moving, non-standard targets. You could only really do such a project with a big team. Maintaining compatibility would be a job by itself.
评论 #41113894 未加载
评论 #41114985 未加载
评论 #41113677 未加载
评论 #41113808 未加载
评论 #41114924 未加载
评论 #41116049 未加载
评论 #41115502 未加载
rubenfiszel10 months ago
At windmill.dev, when users deploy their code, we use Bun build (which is similar to esbuild) to bundle their scripts and all their dependencies into a single js file to load which improve cold start and memory usage. We store the bundle on s3 because of the size of the bundles.<p>If we could bundle everything to native that would completely change the game since as good as bun&#x27;s cold start is, you can&#x27;t beat running straight native with a small binary.
评论 #41115066 未加载
syrusakbary10 months ago
It&#x27;s awesome to see how more JS runtimes try to approach Wasm. This project reminds me to Static Hermes (the JS engine from Facebook to improve the speed of React Native projects on iOS and Android).<p>I&#x27;ve spent a bit of time trying to review each, so hopefully this analysis will be useful for some readers. What are the main commonalities and differences between Static Hermes and Porffor?<p><pre><code> * They both aim for JS test262 conformance [1] * Porffor supports both Native and Wasm outputs while Static Hermes is mainly focused on Native outputs for now * Porffor is self-hosted (Porffor is written in pure JS and can compile itself), while Static Hermes relies on LLVM * Porffor currently doesn&#x27;t support async&#x2F;promise&#x2F;await while Static Hermes does (with some limitations) * Static Hermes is written in C++ while Porffor is mainly JS * They both support TypeScript (although Static Hermes does it through transpiling the TS AST to Flow, while Porffor supports it natively) * Static Hermes has a fallback interpreter (to support `eval` and other hard-to-compile JS scenarios), while Porffor only supports AOT compiling (although, as I commented in other thread here, it maybe be possible to support `eval` in Porffor as well) </code></pre> In general, I&#x27;m excited to see if this project can gain some traction so we can speed-up Javascript engines one the Edge! Context: I&#x27;m Syrus, from Wasmer [3]<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;hermes&#x2F;discussions&#x2F;1137">https:&#x2F;&#x2F;github.com&#x2F;facebook&#x2F;hermes&#x2F;discussions&#x2F;1137</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;test262">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;test262</a><p>[3] <a href="https:&#x2F;&#x2F;wasmer.io">https:&#x2F;&#x2F;wasmer.io</a>
评论 #41116392 未加载
评论 #41114961 未加载
评论 #41114977 未加载
评论 #41114086 未加载
评论 #41114951 未加载
brundolf10 months ago
There&#x27;s a subset of JS that&#x27;s trivially compilable, it&#x27;s the long tail of other stuff that&#x27;s hard. But cool to see research happening on where that boundary lies and how much benefit can be had for that subset
vanderZwan10 months ago
I unironically appreciate that it supports String.blink. It&#x27;s always a good sign if the developer has a sense of humor and playfulness.
评论 #41119995 未加载
评论 #41123409 未加载
CharlesW10 months ago
What subtleties am I missing that makes &quot;ahead-of-time JS engine&quot; a better description than &quot;JS-to-Wasm compiler&quot;? (If it&#x27;s mostly a framing strategy, that&#x27;s cool too.)
评论 #41115375 未加载
nick_g10 months ago
I&#x27;m a bit suspicious of the versioning scheme described here[0]<p>If some change were required which introduced a regression on some Test262 tests, it could cause the version number to regress as well. This means Porffor cannot have both a version number which increases monotonically and the ability to introduce necessary changes which cause Test262 regressions<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;CanadaHonk&#x2F;porffor?tab=readme-ov-file#versioning">https:&#x2F;&#x2F;github.com&#x2F;CanadaHonk&#x2F;porffor?tab=readme-ov-file#ver...</a>
评论 #41114017 未加载
评论 #41114039 未加载
mproud10 months ago
“Purple” in Welsh
评论 #41114909 未加载
Sytten10 months ago
Its refreshing to see all the various JS engines that are out there for various usecases.<p>I have been working on providing quickjs with more node compatible API through llrt [1] for embedding into applications for plugins.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;awslabs&#x2F;llrt">https:&#x2F;&#x2F;github.com&#x2F;awslabs&#x2F;llrt</a>
xyproto10 months ago
Promising, but a few rough edges.<p>&gt; 1+1<p>2<p>&gt; help<p>Uncaught ReferenceError: help is not defined at exports.&lt;computed&gt; [as main] (file:&#x2F;&#x2F;&#x2F;opt&#x2F;homebrew&#x2F;lib&#x2F;node_modules&#x2F;porffor&#x2F;compiler&#x2F;wrap.js:494:19) at REPLServer.run (file:&#x2F;&#x2F;&#x2F;opt&#x2F;homebrew&#x2F;lib&#x2F;node_modules&#x2F;porffor&#x2F;runner&#x2F;repl.js:98:27) at bound (node:domain:432:15) at REPLServer.runBound [as eval] (node:domain:443:12) at REPLServer.onLine (node:repl:927:10) at REPLServer.emit (node:events:532:35) at REPLServer.emit (node:domain:488:12) at [_onLine] [as _onLine] (node:internal&#x2F;readline&#x2F;interface:416:12) at [_line] [as _line] (node:internal&#x2F;readline&#x2F;interface:887:18)
userbinator10 months ago
<i>Porffor can compile to real native binaries without just packaging a runtime like existing solutions.</i><p>Any language that allows generating and interpreting its own code at runtime will have the &quot;eval problem&quot;. From some other comments here, it sounds like Porffor&#x27;s solution is to simply ignore it.
评论 #41121363 未加载
rvnx10 months ago
Seems like the same idea that Facebook had with PHP which was to transpile PHP to C.<p>It was called hiphop-php, then they eventually gave up, before creating hhvm on a complete new concept.
评论 #41114203 未加载
ijustlovemath10 months ago
I&#x27;d love to know if there&#x27;s a way to compile NodeJS to native libraries with this! I have a process [0], but it&#x27;s a bit hacky and error prone<p>[0] - <a href="https:&#x2F;&#x2F;github.com&#x2F;ijustlovemath&#x2F;jescx">https:&#x2F;&#x2F;github.com&#x2F;ijustlovemath&#x2F;jescx</a>
giancarlostoro10 months ago
The most interesting bit about Porffor in my eyes is it lets JavaScript compete with something like Blazor (or allows JS to stand its ground), which kind of makes using any JS in your project redundant, since all your front-end logic can be done in C#. The reason I say this is, because obviously, there are JS devs, but if WASM tooling in other languages grows it will make JS redundant or feel incomplete &#x2F; outcompeted.<p>I wont be surprised to see a SPA framework that uses Porffor once it is more mature, or even the major ones using it as part of their tooling.<p>WASM is the next step after SPA&#x27;s essentially.<p>If you have never touched Blazor, I recommend you check it out via youtube video if you don&#x27;t do any C#, it is impressive. Kudos to Microsoft for it. I have had 0 need or use for JavaScript since using it.
评论 #41119555 未加载
FpUser10 months ago
I find this very interesting. Keep it up and bring it to production shape
solumos10 months ago
Just out of curiosity, how does the performance (compilation + runtime) compare to something like bun[0]?<p>[0] <a href="https:&#x2F;&#x2F;bun.sh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bun.sh&#x2F;</a>
Borkdude10 months ago
I got &quot;TodoError: no generation for ImportDeclaration!&quot; for this script:<p>import * as squint_core from &#x27;squint-cljs&#x2F;core.js&#x27;; console.log(&quot;hello&quot;);
WatchDog10 months ago
How does this compare to quickJS, which can also compile JS to native code(with a C compiler)
评论 #41117150 未加载
saagarjha10 months ago
What happens when someone calls eval?
评论 #41113969 未加载
评论 #41114917 未加载
评论 #41114069 未加载
THBC10 months ago
This seems like an opaque supply chain attack waiting to happen.
xiaodai10 months ago
Stop trying to retrofit garbage on garbage. Go direct to WebAsm already