Structured Concurrency

Thread 跟 Coroutine 是兩種常常用來處理 Concurrency 的工具。

使用這兩個工具時,很麻煩的一點就是需要手動管理他們的生命週期。本質上,Thread 跟 Coroutine 都是 global scope,不管你如何建立,他們都獨立在原本的程式順序之外。

常見的例子是,如果你在 main 建立一個新的 thread,main 並不會等 thread 結束,而需要你手動 join thread,在複雜的情況(例如 cancel、timeout)便相當容易出錯。

而 Structured Concurrency 就是試圖將 Thread 的生命週期與大家都很熟悉的 scope 結合。

» Read More


工程師的英文寫作能力

寫作能力一直是工程師實力一個很重要的指標。

能清楚的透過文字表達,在寫規格、文件時都很重要。在這個非同步的遠端工作時代,文字能力也幾乎直接代表了團隊合作的能力。

» Read More


Go,七年後

開始接觸 Go 到現在也已經過了 7 年了啊… 最近又有機會拿出 Go 出來寫寫,隨手寫一下感受。

» Read More


Notes on the Implementation of Lua 5.3

Notes on the Implementation on Lua 5.3 is a collection of my notes on the Lua 5.3 source code. It’s a mix of both high-level ideas and interesting details in the source code.

» Read More


為什麼現代遊戲都要有一堆不同的貨幣在裡頭?

image

» Read More


Analyze Streaming Data with Rust, Actix, and Lua

actix-lua provides a safe scripting environment for the actix framework with the Lua Programming Language.

Here’s an example about what you can achieve with it. Hope you can try these ideas in your next project.

» Read More


我選擇生產力工具的基準

先說結論,我用 OmniFocus 用了五年以上了,目前依然滿意。

» Read More


如何整合 Rust 與 Lua

image

Photo by Anders Jildén on Unsplash

在系統中遷入一個動態輕巧的 scripting language 一直是個常見的設計。像 Rust 這樣的系統語言,雖然效能好,但是上手門檻較高。這時若是能遷入一個像 Lua 一樣動態型別,簡單易懂的語言,便能大幅提高系統彈性。

最近為了實做 actix-lua,研究了一下 Rust 跟 Lua 之間的介接,順便學了不少 Rust 跟 Lua 的設計,筆記在此。

» Read More


軟體設計模式 — Data-Oriented Design

image

Photo by Rebecca Oliver on Unsplash

遊戲開發對很多開發者來說是個陌生的領域。遊戲對於效能的極高要求跟規格的不確定性,產生出了許多特有的系統架構。Data-Oriented Design 便是個有趣的設計模式。

相較於其他設計模式,Data-Oriented Design 深受硬體快取(cache)架構影響。對於現代的高度 pipeline、高速的 CPU 架構而言,資料的存取方式對效能有非常大的影響。比起 L1、L2 cache,對主記憶體的一次存取帶來的是數百倍的效能損耗。為了避免太過抽象,就用個實際的例子來解釋吧。

» Read More


LuaJIT 實做探索 — NaN Tagging

image

一切都是為了效能

故事要從 boxed value 跟 unboxed value 說起。

» Read More