Your SlideShare is downloading. ×
  • Like
Hubris
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

A presentation given at Ruby on Rails Sydney, 8 September 2009, on the Hubris Ruby-Haskell bridge.

A presentation given at Ruby on Rails Sydney, 8 September 2009, on the Hubris Ruby-Haskell bridge.

Published in Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,554
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
10
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME Hubris subjecting Haskell to Ruby’s iron will Mark Wotton <mwotton@shimweasel.com> September 8, 2009 Mark Wotton <mwotton@shimweasel.com> Hubris
  • 2. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME I n Ruby concise and flexible Big web community, many libraries Fun Mark Wotton <mwotton@shimweasel.com> Hubris
  • 3. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME I n Haskell Fast (optimised native code, multicore, etc) Mark Wotton <mwotton@shimweasel.com> Hubris
  • 4. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME I n Haskell Fast (optimised native code, multicore, etc) Expressive - type systems don’t have to suck. Mark Wotton <mwotton@shimweasel.com> Hubris
  • 5. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME I n Haskell Fast (optimised native code, multicore, etc) Expressive - type systems don’t have to suck. Provably safe at compile time Mark Wotton <mwotton@shimweasel.com> Hubris
  • 6. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME the slide that’s going to get me lynched JRuby vs GHC Program Time Memory Source Size reverse-complement 5 1 1/4 regex-dna 7 3 1/5 binary-trees 8 7 1 k-nucleotide 10 1 1/7 pidigits 18 18 2 n-body 26 53 1 chameneos-redux 30 24 1 fasta 31 142 1 fannkuch 45 22 1/4 spectral-norm 227 56 1/3 mandelbrot 319 3 1/2 Mark Wotton <mwotton@shimweasel.com> Hubris
  • 7. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME 319 times? Really? Haskell code written by expert hackers Mark Wotton <mwotton@shimweasel.com> Hubris
  • 8. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME 319 times? Really? Haskell code written by expert hackers Longer in some cases - gone hard on optimisations even when they blow out source code size. But... Mark Wotton <mwotton@shimweasel.com> Hubris
  • 9. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME 319 times? Really? Haskell code written by expert hackers Longer in some cases - gone hard on optimisations even when they blow out source code size. But... 319 times faster, 1/3 the memory. Mark Wotton <mwotton@shimweasel.com> Hubris
  • 10. Two cultures lies, damn lies, benchmarks Hubris problems with Haskell TODO, gotchas, FIXME more lies to outrage Myles there are approximately twelve programmers in the world who know Haskell Nine are working on four different compilers with extensions for solving logic puzzles in the type system (not kidding, google “haskell instant insanity”) The other three are working on six different web frameworks Mark Wotton <mwotton@shimweasel.com> Hubris
  • 11. Two cultures Haskell example Hubris wrap it in Ruby TODO, gotchas, FIXME Peanut butter, meet chocolate Ruby has a heap of web frameworks, convenience libraries, well-tested integration with javascript + CSS Haskell is smoking fast with rock solid type safety but a tiny community Hubris is my bridge between the two Mark Wotton <mwotton@shimweasel.com> Hubris
  • 12. Two cultures Haskell example Hubris wrap it in Ruby TODO, gotchas, FIXME lazy, statically typed, and pure clMax l i m = maximumBy ( c o m p a r i n g snd ) ( a s s o c s a r r ) where a r r = l i s t A r r a y ( 1 , l i m ) ( 0 : ( map d e p t h [ 2 . . ] ) ) s t e p x = i f even x then d i v x 2 else 3 ∗ x + 1 d e p t h x = 1 + i f n <= l i m then a r r ! n e l s e depth n where n = s t e p x Mark Wotton <mwotton@shimweasel.com> Hubris
  • 13. Two cultures Haskell example Hubris wrap it in Ruby TODO, gotchas, FIXME actually using it r e q u i r e Hubris # my f a v o u r i t e l i n e c = C o l l a t z . new # any r u b y o b j e c t c . i n l i n e ( h a s k e l l s t r i n g ) # from ab ove p u t s c . clMax ( 1 0 0 0 0 0 0 ) >> 837799 Mark Wotton <mwotton@shimweasel.com> Hubris
  • 14. Two cultures Hubris TODO, gotchas, FIXME Making it less sucky Needs to use jhc, because ghc can’t produce dynamic libs right now (works with GHC HEAD, will be compatible with 6.12) one-way bridge, no callbacks to Ruby a smarter mapping layer caching of Haskell binaries cleanup of ruby interface shore up support for arrays, hashes, BigInts autoconf support to find ruby libs and includes ... lots to do Mark Wotton <mwotton@shimweasel.com> Hubris
  • 15. Two cultures Hubris TODO, gotchas, FIXME Try it out! install GHC and JHC git clone git://github.com/mwotton/Hubris.git follow the README tell me what’s missing patches very much welcome (thanks to Josh Price, James Britt and Tatsuhiro Ujihisa) Mark Wotton <mwotton@shimweasel.com> Hubris
  • 16. Two cultures Hubris TODO, gotchas, FIXME Learning Haskell Learn You A Haskell: why the lucky stiff’s academic cousin Real World Haskell: awesome, practical introduction haskell channel on freenode beginners@haskell.org Mark Wotton <mwotton@shimweasel.com> Hubris