Profile

Cover photo
Jan Achrenius
165 followers|57,596 views
AboutPostsPhotosYouTube

Stream

 
 
I implemented a nontrivial algorithm in Apple's Swift, and the performance was miserable. Then I started digging deeper, and noticed that something as simple as sorting an array of integers can be surprisingly slow in Swift.

Here are some benchmarks that compare Swift, pure Python, and C++. I am just sorting an array with 1 million random integers, using the "sort" function from the standard library:

— C++ -O3: 0.06 s
— C++ -O0: 0.06 s
— Python: 0.6 s
– Swift -O3: 6 s
– Swift -O0: 88 s.

Both the C++ compiler (clang++) and the Swift compiler were from Apple's Xcode 6 beta.

Seriously, what is wrong here? Of course I am a total beginner with Swift, but I do not see much room for user errors here: "let y = sort(x)", where x is a million-element array of type "Int[]".

#swift   #notsoswift  
1
Add a comment...

Jan Achrenius

Shared publicly  - 
 
Can't stop the rock. Take control of an energetic, running, jumping, swingi...
1
1
Levi Bard's profile photo
Add a comment...

Jan Achrenius

commented on a video on YouTube.
Shared publicly  - 
 
Nice. And nice to see you're still going strong, Nick.
1
Add a comment...

Jan Achrenius

Shared publicly  - 
1
Add a comment...
 
 
"Using historical production data, we calculate that global nuclear power has prevented an average of 1.84 million air pollution-related deaths and 64 gigatonnes of CO2-equivalent (GtCO2-eq) greenhouse gas (GHG) emissions that would have resulted from fossil fuel burning. On the basis of global projection data that take into account the effects of the Fukushima accident, we find that nuclear power could additionally prevent an average of 420 000–7.04 million deaths and 80–240 GtCO2-eq emissions due to fossil fuels by midcentury, depending on which fuel it replaces."
1
Add a comment...

Jan Achrenius

Shared publicly  - 
1
Dylan Paris's profile photo
 
Woot! New SIGGRAPH demos are always a high point of the year.
Add a comment...
Have him in circles
165 people
Jari Komppa's profile photo
Timo Haanpää's profile photo
Otso Mäkinen's profile photo
Pyry Haulos's profile photo
Jouni Rajala's profile photo
Sampsa Lehtonen's profile photo
Miguel Cepero's profile photo

Jan Achrenius

Shared publicly  - 
 
Motörhead x Finnish rautalanka
 
From the deep core of the Finnish culture comes this. 
 ·  Translate
1
Add a comment...

Jan Achrenius

Shared publicly  - 
 
 
I've been watching you, a lalalala int32, a lalalala int64 LE int128, come on, a lalalala int32, a lalalala int64 LE int128, hey-a.

(inspired by +Jari Komppa)
1
Add a comment...

Jan Achrenius

Shared publicly  - 
 
Pay what you want.
 
This week’s Humble Weekly Sale features Rochard from Recoil Games! Name your price and get Rochard and Rochard: Hard Times DRM-free and on Steam for Windows, Mac, and Linux, plus the Rochard digital art book and original soundtrack!

http://www.humblebundle.com/weekly

Check out the site for more details!
2
1
Mikko Kautto's profile photo
Add a comment...

Jan Achrenius

Shared publicly  - 
 
Finnish country. We have no cowboys, just coders.
1
Jarkko Lempiäinen's profile photo
 
And plenty of cowboy coders :D
Add a comment...

Jan Achrenius

Shared publicly  - 
 
Proof for Goldbach's weak conjecture
 
Busy day in analytic number theory; Harald Helfgott has complemented his previous paper http://arxiv.org/abs/1205.5252 (obtaining minor arc estimates for the odd Goldbach problem) with major arc estimates, thus finally obtaining an unconditional proof of the odd Goldbach conjecture that every odd number greater than five is the sum of three primes.  (This improves upon a result of mine from last year http://terrytao.wordpress.com/2012/02/01/every-odd-integer-larger-than-1-is-the-sum-of-at-most-five-primes/ showing that such numbers are the sum of five or fewer primes, though at the cost of a significantly lengthier argument.) As with virtually all successful partial results on the Goldbach problem, the argument proceeds by the Hardy-Littlewood-Vinogradov circle method; the challenge is to make all the estimates completely effective and to optimise all parameters (which, among other things, requires a certain amount of computer-assisted computation).
1
1
Janne Kontkanen's profile photo
Add a comment...
People
Have him in circles
165 people
Jari Komppa's profile photo
Timo Haanpää's profile photo
Otso Mäkinen's profile photo
Pyry Haulos's profile photo
Jouni Rajala's profile photo
Sampsa Lehtonen's profile photo
Miguel Cepero's profile photo
Links
Other profiles
Contributor to
Basic Information
Gender
Male
Apps with Google+ Sign-in