13

用 JavaScriptCore 實做的一站式方案 Bun

 1 year ago
source link: https://blog.gslin.org/archives/2022/07/11/10791/%e7%94%a8-javascriptcore-%e5%af%a6%e5%81%9a%e7%9a%84%e4%b8%80%e7%ab%99%e5%bc%8f%e6%96%b9%e6%a1%88-bun/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

用 JavaScriptCore 實做的一站式方案 Bun

前幾天在 Hacker News 上討論得很熱烈的 Bun:「Bun: Fast JavaScript runtime, transpiler, and NPM client written in Zig (bun.sh)」。

從 Hacker News 上的標題上就可以看到 Bun 做了不少事情,看起來想要打造一個 all-in-one 環境,把所有開發與 server 端 JavaScript 所需要的東西就一次包進來,不需要在自己東挑西挑...

比較特別的是 Bun 在選 JavaScript Engine 的時候是選擇 Apple 家推出的 JSC (或者稱 JSCore,正式名稱是 JavaScriptCore),而不是現在主流的 V8 (Google 家),據說這樣比較省記憶體,但 server 端應用應該是不缺這個記憶體才對?

JavaScript runtime with Web APIs like fetch, WebSocket, and several more built-in. bun embeds JavaScriptCore, which tends to be faster and more memory efficient than more popular engines like V8 (though harder to embed)

另外一個是強調啟動速度,這對開發應該有幫助,但對 server 應用來說好像還好:

Bun.js uses the JavaScriptCore engine, which tends to start and perform a little faster than more traditional choices like V8.

在官方宣稱的效能測試上可以看到很多改善,感覺是個還蠻「有趣」的方案,可以繼續觀察看看,畢竟現在是 beta 版,另外也讓子彈飛一下,是不是只有列出來的那些會比較快...

Related

Cloudflare 的 D1 (SQLite as a service)

在 Hacker News Daily 上看到 Cloudflare 推出了新產品 D1:「Announcing D1: our first SQL database」,在 Hacker News 上對應的討論在「D1: Our SQL database (cloudflare.com)」這邊可以看到。 就如同 Hacker News 上的討論提到的,這篇文章不像一般的 Cloudflare 文章會帶有很多技術上的說明 (尤其是在描述技術產品),這篇算是非常的行銷導向的文章,目前大家只能靠「猜」的去理解: For a Cloudflare article, this one is surprisingly light on technical details. And for the product where it most matters. 翻了一下這兩個屬名的作者,Rita Kozlov 是…

May 12, 2022

In "Cloud"

無名小站的 XSS 安全漏洞

前言 布丁大長輩 在 Year.new(2006) 這篇幹剿無名小站的 XSS 安全漏洞,沒有講的很明白,加上我這陣子沒在實驗室遇到 wkwu (是的,我跟他是同一個指導教授),所以一直沒有跟他說這個在國外已經「開發」好一陣子的安全漏洞。 Javascript 是在使用者端 (Browser) 跑的程式,理論上來說,讓使用者輸入自己的 Javascript 並不會有什麼問題,但實際上自從 XMLHttpRequest() 被大量應用後 (一開始發展 AJAX 所使用的核心技術之一),有些人就發現 XMLHttpRequest() 是可以拿來當作攻擊的工具。 舉例說明 舉個例子說明會比較清楚。以目前最大的 無名小站 為例,「修改個人資料」的頁面是在 http://www.wretch.cc/user/modify.php?admin_user=1 這個位置,會以 POST 的方式送給 http://upload.wretch.cc/user/do_modify.php,那麼我就可以在文章裡面嵌入一段 Javascript:(修改自 Use the XMLHttpRequest Object to Post Data) var objHTTP, strResult; objHTTP = new ActiveXObject('Microsoft.XMLHTTP'); objHTTP.Open('POST', "http://upload.wretch.cc/user/do_modify.php",false); objHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');…

January 6, 2006

In "Blog"

GOV.UK 拔掉網頁上的 jQuery

英國政府的網站拔掉 jQuery 了:「GOV.UK drops jQuery from their front end.」,Hacker News 上的討論也可以看一下:「Gov.uk drops jQuery from their front end (web.dev)」。 當年會選擇用 jQuery 大概有幾個原因,第一個是當年 (很舊的 browser 版本) 對 DOM 的操作非常的混亂,像是: 有 appendChild() (IE5+) 但沒有 prependChild()。後來才有 append() 與 prepend() (兩個在 IE 都沒支援,要到 Edge 17+)。 有 insertBefore() (IE6+) 但沒有 insertAfter()。後來是透過 insertAdjacentElement() (IE5+ but only for…

May 20, 2022

In "Browser"

a611ee8db44c8d03a20edf0bf5a71d80?s=49&d=identicon&r=gAuthor Gea-Suan LinPosted on July 11, 2022Categories Computer, Murmuring, Programming, SoftwareTags bun, engine, javascript, javascriptcore, js, jsc

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Notify me of follow-up comments by email.

Notify me of new posts by email.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK