Get the latest tech news

VPTERNLOG: when three is 100% more than two


Paul Khuong's personal blog. Some Lisp, some optimisation, mathematical or computer.

A little bit of thinking reveals a big win at smaller (reasonable) scales: a binary operator takes two values and outputs one, while a ternary operator takes three and outputs one. In a reduction, each application of the binary operator decrements the number of values by \(2 - 1 = 1\), but each application of the ternary operator decrements it by \(3 - 1 = 2\)! We thus need half as many ternary operations to reduce a given number of bitvectors, compared to binary operations… and it’s not like the throughput (or latency for that matter) is worse.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Vpternlog

Vpternlog