PiBench Logo

PiBench

A Cross-Platform Pi Calculation Benchmark

PiBench is a small, single-core benchmark application that calculates Pi to millions of digits.

It provides native implementations for iOS, Android, Linux, and Windows for both ARM64 and x86_64 architectures.

The core Pi calculation algorithm is using the Arithmetic-Geometric Mean (AGM) algorithm. The implementation uses Fast Fourier Transform (FFT) for multiplication of large numbers and is based on T.Ooura's SuperPI implementation, developed at Kyoto University.

Frequently Asked Questions

Is PiBench measuring real world performance?

Not really. PiBench is a single-core benchmark doing a specific mathematic calculation. It's really good for measuring architectural differences though. For example how much faster Apple's new M5 chip is compared to M4.

What technologies are used for each platform?

Benchmark library: Written in C, common on all platforms.

iOS: UIKit in Objective-C (Using any Swift code makes the benchmark slower for some reason).

Android: Written in Java with JNI bridge to the C library.

Linux: GTK3 written in C, using Cairo for the UI rendering.

Windows: Win32 API, C++ using GDI+ for the rendering. Compiled with clang since the performance was better than msvc

How long does a calculation take?

The benchmark runs 5 consecutive calculations of 8 million digits and averages the scores. Depending on your device's performance, each 8M calculation typically few seconds. The entire benchmark (5 runs) usually completes in less than a minute in most modern devices.

Can I compare scores between different platforms?

That was the target all along. Since all platforms use the same calculation algorithm and scoring system, you can directly compare benchmark scores across iOS, Android, Linux, and Windows devices.

Is it open source?

No, not yet at least.

Where are the leaderboards?

There are no leaderboards at them moment. If people like PiBench i might dedicate some time to do it.