Giter VIP home page Giter VIP logo

msort's Introduction

largesort

Go

Building

go build ./...

Unit tests

go test ./...

Integration test

cd cmd/largesort
./test.sh

Improvements

  • using 32 bit binary for intermediate files
  • using unsafe casts to read and write files directly into []int64 without going through binary.LittleEndian
  • run merges in parralel
  • initially we waited for the initial leafSort pass to complete before starting merging the chunks. We now start merging as soon as the first two chunks have been written.
  • use int32 rather than int64, halving the amnount of disk io.

This speeds up sort time by a factor of 3.

Before the changes

generating 10000000 random numbers
running largesort
real	0m17.807s
user	0m14.183s
sys	0m2.845s

After the changes

generating 10000000 random numbers
running largesort
real	0m4.840s
user	0m4.469s
sys	0m0.675s

TODO

We should probably limit the number of active goroutines to the number of cores on the machine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.