Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3923)

Issue 58550043: code review 58550043: sort: add type-specific internal versions of Sort() and...

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 3 months ago by mtj
Modified:
10 years, 2 months ago
Visibility:
Public.

Description

sort: add type-specific internal versions of Sort() and Stable() This change replaces the existing "virtual all the way down" mechanism with a type switch and dispatch to type specific versions of the Sort() and Stable() routines. No change is made to the sorting algorithms, the purpose is to remove needless type discovery. There is also no change to the API. The result is a 3x-4x speedup when sorting any of the built-in styles: []int, []float64, and []string. Could be easily extended to other standard types if desired. Also made a few spelling fixes in comments.

Patch Set 1 #

Patch Set 2 : diff -r 96b485225cef https://code.google.com/p/go #

Patch Set 3 : diff -r 96b485225cef https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+796 lines, -8 lines) Patch
M src/pkg/sort/sort.go View 1 15 chunks +796 lines, -8 lines 0 comments Download

Messages

Total messages: 11
mtj
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 3 months ago (2014-01-30 07:02:12 UTC) #1
bradfitz
Sadness. If the compiler did this behind the scenes, I'd take the code size hit ...
10 years, 3 months ago (2014-01-30 09:09:17 UTC) #2
mtj
Well, I don't want to be off-topic, but this is why people agitate for a ...
10 years, 3 months ago (2014-01-30 19:13:03 UTC) #3
mtj
On 2014/01/30 19:13:03, mtj wrote: > Well, I don't want to be off-topic, but this ...
10 years, 2 months ago (2014-02-15 02:00:01 UTC) #4
gri
Please no. The speed advantages are undeniable, but I don't think this is the way ...
10 years, 2 months ago (2014-02-17 22:07:17 UTC) #5
mtj
Can I check in an m4 template and a shell script? On Feb 17, 2014 ...
10 years, 2 months ago (2014-02-17 22:57:14 UTC) #6
bradfitz
Things we need more of in the tree: Perl, awk, shell, and m4. On Feb ...
10 years, 2 months ago (2014-02-17 23:06:58 UTC) #7
mtj1
Actually what we need less of is the oft quoted diatribe against macros and generics. ...
10 years, 2 months ago (2014-02-18 02:08:13 UTC) #8
bradfitz
I have nothing against programs generating programs. But the trend in the Go tree has ...
10 years, 2 months ago (2014-02-18 22:11:14 UTC) #9
mtj1
I played with this today on the plane (SFO->IAD) and as a test only, not ...
10 years, 2 months ago (2014-02-19 04:14:48 UTC) #10
rsc
10 years, 2 months ago (2014-03-05 20:23:20 UTC) #11
not lgtm
R=close

We know that you can make this faster by macro expansion. We'd rather not. I've
resorted to custom sorts in some of my code too (and then if you're doing that
you can make them even faster, such as by using radix sort in some cases).
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b