Skip to main content

Wow PyPy

Recently, I read about executing python scripts faster, so I wanted to test out pypy. As it turns out, using pypy is not even much faster than python3, but it is faster than C# as well. Impressive. Previous C# vs Python test.

python3 sp.py (~ 22.75 seconds):

2021-04-30 13:18:32.646116

2021-04-30 13:18:55.456401

2021-04-30 13:19:18.182853

2021-04-30 13:19:40.847922

2021-04-30 13:20:03.548258

2021-04-30 13:20:26.182298

2021-04-30 13:20:49.132793


pypy sp.py (~ 1.47 seconds):

2021-04-30 13:21:20.140819

2021-04-30 13:21:21.461551

2021-04-30 13:21:22.892700

2021-04-30 13:21:24.451105

2021-04-30 13:21:25.888588

2021-04-30 13:21:27.267887

2021-04-30 13:21:28.937091


C# debug (~ 2.15 seconds):

2021-04-30 13:34:23.613
2021-04-30 13:34:25.734
2021-04-30 13:34:27.869
2021-04-30 13:34:30.067
2021-04-30 13:34:32.092
2021-04-30 13:34:34.255
2021-04-30 13:34:36.486

C# release (~ 1.87 seconds):

2021-04-30 13:37:39.637
2021-04-30 13:37:41.524
2021-04-30 13:37:43.332
2021-04-30 13:37:45.236
2021-04-30 13:37:46.992
2021-04-30 13:37:48.873
2021-04-30 13:37:50.831

Times for different executions of same script

For C# I added for print out "Console.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture));". The times changed since the last test as I have new machine.

Installation of pypy is easy as well on Ubuntu ('sudo apt-get install pypy').