Re: [Haskell-cafe] Strings in Haskell
John Meacham wrote: > On Mon, Jan 22, 2007 at 09:37:21PM -0500, Bryan Donlan wrote: > >>Or you can get the best of both worlds by using Data.ByteString.Lazy :) >>Even with laziness, all the indirections that String causes hurts >>performance. > > > actually, strictness analysis is really good at unboxing things like > this, so the indirections probably hurt less than one would initially > think. One thing that's impressed me with the Haskell application I'm currently working on (as I am trying to bully the code into handling 10M rows of data, which must all be kept in memory at once, without keeling over) is how often adding explicit strictness annotations *hasn't* improved performance. I guess this means that GHC's strictness analysis isn't much worse than my own. (and that my algorithms are such crap that issues of laziness/strictness are the least of my problems... :-) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
On 1/23/07, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote: generate financial models for execution by clusters running Excel. There used to be, on Slashdot, a saying: "Now imagine a Beowulf cluster of these!" :) Cheers, Alexy ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
Hello, On 1/23/07, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote: Tim Docker wrote: > I'm not aware of any ongoing haskell work in finance, other that > some private work being done by Alain Cremieux, reported in the HCAR. Lennart Augustsson works for Credit Suisse, using a Haskell DSEL to generate financial models for execution by clusters running Excel. (This I gleaned from him in IRC the other day; apologies to Lennart if I misremember the specifics.) I believe that Goldman Sachs might be using Haskell, too, but I don't know for sure (they have at least one ex-Yale FRP person, at any rate). Wall Street has long had a fondness for esoteric technologies (APL, Linda, you name it). I'm sure there are more Haskell users lurking there somewhere. I work at Deutsche Bank. I am using Haskell to manage several databases, using HDBC and HAppS, and do some data mining and (light) numerical calculation. -Jeff ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
On Mon, Jan 22, 2007 at 09:37:21PM -0500, Bryan Donlan wrote: > Or you can get the best of both worlds by using Data.ByteString.Lazy :) > Even with laziness, all the indirections that String causes hurts > performance. actually, strictness analysis is really good at unboxing things like this, so the indirections probably hurt less than one would initially think. I think the main issue with string processing speed is not so much the representation of characters, it is that the natural way to express algorithms in haskell is always a character at a time, rather than working on chunks of text at once. of course, Data.ByteStream can let you do this too, but you start to diverge from idiomatic haskell. Not that that is inherently the case forever. John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
Tim Docker wrote: I'm not aware of any ongoing haskell work in finance, other that some private work being done by Alain Cremieux, reported in the HCAR. Lennart Augustsson works for Credit Suisse, using a Haskell DSEL to generate financial models for execution by clusters running Excel. (This I gleaned from him in IRC the other day; apologies to Lennart if I misremember the specifics.) I believe that Goldman Sachs might be using Haskell, too, but I don't know for sure (they have at least one ex-Yale FRP person, at any rate). Wall Street has long had a fondness for esoteric technologies (APL, Linda, you name it). I'm sure there are more Haskell users lurking there somewhere. http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
On Jan 23, 2007, at 10:37 PM, Tim Docker wrote: I'm not aware of any ongoing haskell work in finance, I'm gearing up to do something but don't have anything to show yet. I'd be happy to learn of any more, however. I don't think there's any reasons right now why one ought to favour ocaml over haskell in this domain. The reason OCaml was used for LexiFi was _not_ performance. I think Jean-Marc Eber was just a big OCaml user and shared offices or was close to the OCaml team at INRIA. The reason Jane St. is usign OCaml is definitely performance. These guys are trying to shave milliseconds of their processing time. The reason I want to use Haskell where OCaml seems to be more appropriate is because I'm stubborn and a sucker for punishment :-). OCaml also doesn't hold a candle to Haskell in elegance. Think let ... in ..., begin ... end or parens instead of the same, rules for using 'and' in function clauses, etc. etc. etc. I like elegance and hope that performance will catch up, specially with the great strides made in binary IO and data-parallel Haskell. Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Strings in Haskell
Alexy Khabrov wrote: > I wonder if that's another reason OCaml is used in a(t least one) > hedge fund -- why Jane St. preferred OCaml to Haskell, I wonder? Was > it the state of affairs then that OCaml was more efficient (? -- > WAGuess), and would they prefer Haskell now? Ocaml definitely has more visibility in finance, due to at least two real world uses: - at Jane St Capital - The lexifi contract description language (www.lexifi.com) I'm not aware of any ongoing haskell work in finance, other that some private work being done by Alain Cremieux, reported in the HCAR. I'd be happy to learn of any more, however. I don't think there's any reasons right now why one ought to favour ocaml over haskell in this domain. Tim ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
I wonder if that's another reason OCaml is used in a(t least one) hedge fund -- why Jane St. preferred OCaml to Haskell, I wonder? Was it the state of affairs then that OCaml was more efficient (? -- WAGuess), and would they prefer Haskell now? I'm trying to make sense out of OCaml objects out of that already infamously annoying "Practical OCaml" book, and class object ... doesn't look like much, not to say that "class object" sounds about as bad as most English in that book. (Written by an English major... What a decline in US education! :) I come from ML background, so Haskell laziness and OCaml objects are all new to me. But my Haskell book, Haskell School of Expression, is so much better written, that I'm reading it much faster. I'm CC'ing Yaron as his e-mail comes up in my Gmail context adwords on the word "Haskell." :) I'm interested in financial data mining and market modeling -- are there any good application of FP there, say in Lisp? Cheers, Alexy P.S. Somebody with an old-fashioned mail client please feel free to change the subject to "Financial Engineering with FP," gmail seems to etch its subjects in stone. :) On 1/23/07, Martin Jambon <[EMAIL PROTECTED]> wrote: On Mon, 22 Jan 2007, Alexy Khrabrov wrote: > Greetings -- I'm looking at several FP languages for data mining, and > was annoyed to learn that Erlang represents each character as 8 BYTES > in a string which is just a list of characters. Now I'm reading a > Haskell book which states the same. Is there a more efficient Haskell > string-handling method? Which functional language is the most > suitable for text processing? In OCaml, strings are compact sequences of bytes. And you can pass them as-is to C functions: http://caml.inria.fr/pub/ml-archives/caml-list/2002/08/e109df224ff0150b302033e2002dbf87.en.html Martin -- Martin Jambon http://martin.jambon.free.fr ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
Neil Mitchell wrote: > Hi Alexy, > >> Now I'm reading a >> Haskell book which states the same. Is there a more efficient Haskell >> string-handling method? Which functional language is the most >> suitable for text processing? > > There are the Data.ByteString things, which are great, and have much > less overhead. > > But remember that Haskell is lazy. If you are thinking "well I have to > process a 50Mb file", remember that Haskell will lazily read and > process this file, which substantially reduces the memory requirements > so only a small portion will ever be in memory at a time. Or you can get the best of both worlds by using Data.ByteString.Lazy :) Even with laziness, all the indirections that String causes hurts performance. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
Hi Alexy, Now I'm reading a Haskell book which states the same. Is there a more efficient Haskell string-handling method? Which functional language is the most suitable for text processing? There are the Data.ByteString things, which are great, and have much less overhead. But remember that Haskell is lazy. If you are thinking "well I have to process a 50Mb file", remember that Haskell will lazily read and process this file, which substantially reduces the memory requirements so only a small portion will ever be in memory at a time. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
On Jan 22, 2007, at 7:18 PM, Alexy Khrabrov wrote: Greetings -- I'm looking at several FP languages for data mining, and was annoyed to learn that Erlang represents each character as 8 BYTES in a string which is just a list of characters. Now I'm reading a Haskell book which states the same. The standard string type in Haskell is indeed a linked list of characters, with about 12 bytes of overhead per character. Is there a more efficient Haskell string-handling method? Yes! There is a library called Data.ByteString [1], it is included with the latest versions of GHC and Hugs, and is also available as a standalone package. Data.ByteString represents strings as packed arrays of bytes, so the overhead is about 1 byte per character. This library exhibits fantastic performance, rivaling C's speed while maintaining the elegance of Haskell. Cheers, Spencer Janssen [1] http://www.cse.unsw.edu.au/~dons/fps.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Strings in Haskell
On Mon, Jan 22, 2007 at 05:18:19PM -0800, Alexy Khrabrov wrote: > Greetings -- I'm looking at several FP languages for data mining, and > was annoyed to learn that Erlang represents each character as 8 BYTES > in a string which is just a list of characters. Now I'm reading a > Haskell book which states the same. The book is lying - the size of strings is unspecified and implementation dependant. In GHC String is 12 or 20 bytes per character, depending on construction details. > Is there a more efficient Haskell string-handling method? Yes! Data.ByteString.* implements packed strings of bytes. They are less lazy, and don't support unicode, but they are small (8 bits / character) and fast (I have 100 MBy/s disks and my ByteString-based throwaway filters are IO-bound). > Which functional language is the most suitable for text processing? If you expected any answer other than Haskell, you asked on the wrong list. :) Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe