lichess.org
Donate

what is PNACL

I often see pnacl writing right above when doing chess analysis. What does it mean?
Portable Native Client (PNaCl) in a nutshell allows webapps (we'll say Stockfish in this case) to run native code in the browser, independent of computer architecture, in a safe environment. Basically it's the interface between your computer and Stockfish that is needed to evaluate a position in a fast and universal approach. In place of PNaCl, some others you might come across are: WASM (Web Assembly), and WASMX (Multi-threaded Web Assembly).
PNAcl is also dated/deprecated spec and no longer supported. wonder why sometimes we get wasm and sometimes pnacl?
It's interesting why we still sometimes see PNaCl rather than WASM. I was looking through Lichess' source code on GitHub (called lila) and I came across where it decides which to use. First, it does a test whether PNaCl, WASM, and WASMX are supported individually. Then depending on what's supported, the hierarchy looks as follows:

PNaCl if supported. If not, then
WASMX if supported. If not, then
WASM if supported. If not, then
ASMJS (JavaScript fallback as it's called).

Keep in mind that it only chooses one of these. If your browser supports both WASM and PNaCl, then PNaCl will be chosen over WASM for the engine. I assume PNaCl is faster (at this current point in time) and therefore the at the top of the list.
PNACL (Chrome) is about 10 times faster on my system compared to WASM (Firefox or Edge).
PNaCl is getting deprecated.

To enable WASMX:
- Firefox: Type about:config in address bar and set javascript.options.shared_memory to true (right-click → toggle)
- Chrome: Go to chrome://flags/#enable-webassembly-threads and enable

EDIT: But be warned it was disabled by the browsers for a reason (Spectre + Meltdown vulnerabilities). You should check whether your CPU is affected and patched, and if your browser has site isolation implemented.

This topic has been archived and can no longer be replied to.