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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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

More Related Content

PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
DOCX
Casestudysummary.Birhanu.doxc.
PPTX
Simplify Your Strategy
PDF
Media Convergence - Viral Marketing
PPTX
Why Good Companies Go Bad
PPTX
Why good companies go bad
PPT
Market driven+strategy
PDF
Chapter three presentation - Market Segmentation ppt.
2024 Trend Updates: What Really Works In SEO & Content Marketing
Casestudysummary.Birhanu.doxc.
Simplify Your Strategy
Media Convergence - Viral Marketing
Why Good Companies Go Bad
Why good companies go bad
Market driven+strategy
Chapter three presentation - Market Segmentation ppt.

Recently uploaded (20)

PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
STKI Israel Market Study 2025 version august
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PDF
Enhancing emotion recognition model for a student engagement use case through...
PPTX
Microsoft Excel 365/2024 Beginner's training
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
Module 1.ppt Iot fundamentals and Architecture
sbt 2.0: go big (Scala Days 2025 edition)
sustainability-14-14877-v2.pddhzftheheeeee
Benefits of Physical activity for teenagers.pptx
STKI Israel Market Study 2025 version august
CloudStack 4.21: First Look Webinar slides
Two-dimensional Klein-Gordon and Sine-Gordon numerical solutions based on dee...
Flame analysis and combustion estimation using large language and vision assi...
Getting started with AI Agents and Multi-Agent Systems
A proposed approach for plagiarism detection in Myanmar Unicode text
Hindi spoken digit analysis for native and non-native speakers
Convolutional neural network based encoder-decoder for efficient real-time ob...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
OpenACC and Open Hackathons Monthly Highlights July 2025
Enhancing emotion recognition model for a student engagement use case through...
Microsoft Excel 365/2024 Beginner's training
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Developing a website for English-speaking practice to English as a foreign la...
A review of recent deep learning applications in wood surface defect identifi...
Custom Battery Pack Design Considerations for Performance and Safety
Ad
Ad

Hubris

  • 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