Saturday, March 14, 2026

Pi-sort

On "Pi Day" (3.14), something new with pi digits: "sorting pi"

Pi number has unlimited number of digits, that can be calculated by using optimized mathematical algorithms. Google calculated billions of Pi digits, and made them available online here:

Pi digits have a very interesting property that all digits are uniformly represented, it is almost perfectly pseudo-random, but is always the same: great for comparing other algorithms that need random data, in this case sort algoritms.

GET

Response:
```json
{
  "content": "3141592653"
}    

I did download 1 million of those digits,
and then converted them to an array of 5-digit numbers, total 200000 of them. 

Then I used 10 different sort algorithms to sort those numbers derived from Pi, and measure time.
And I did the test in many programming languages. 

Then created this visualization to showcase differences between algorithms and prog. languages.

One very unusual feature of this test is that code in target prog. languages is auto code-generated by custom tool from common meta-language source (new language that I named DataScript).

Another unusual feature of the test is that all test running is done in Docker containers, based on language optimized images, and controlled by a custom docker-runner tool. 

The visuals provide a few different visualizations options, including primary "pie charts",
in both log and linear view. Faster pi-sort algorithm or language gets bigger "slice of pie"



Pi Sorting Performance

i Note: Faster algorithms get more pie. Slice angle is proportional to speed.

Algorithm
Digits: - Values: -

© 2026 DataScript Performance Dashboard

No comments: