jirka-h / Julia_vs_Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Julia_vs_Python

Simple sum test comparing Python and Julia Performance.

Sum of 1/i for the first 1e8 terms is 40x faster in Julia than in Python.

Sum[1/i,{i,1,1e8}]
Python 3.9.9: 4.48 seconds
Julia version 1.6.4: 0.11 seconds

Python:
sum(1/x for x in range(1,num+1))

Julia:
sum(1/x for x=1:num)

./kahan_sum.py
./kahan_sum.jl

Tested on Intel i7-10850H CPU

About


Languages

Language:Python 84.1%Language:Shell 15.9%