That code is effectively copying the data (thats what those peeks / pokes do), so it stands to reason it would be slow by most performance standards. The reason ByteStrings are fast when used both by C and Haskell is there is a zero-copy `useAsCString`.
Cheers, Thomas On Tue, Jul 13, 2010 at 7:49 AM, Phyx <[email protected]> wrote: > Marshalling large amount of data from and to C > > http://phyx.pastebin.com/WXGBr1bX shows the code I use to do this (it's > autogenerated, so just looking at 1 block should be enough) > > The tool is mine, so i can change the code it generates, but i would need to > know how to do it better first. > > On Tue, Jul 13, 2010 at 3:30 PM, Magnus Therning <[email protected]> > wrote: >> >> On Tue, Jul 13, 2010 at 13:29, Phyx <[email protected]> wrote: >> > Hello >> > >> > I'm wondering if anyone ever benchmarked marshalling in Haskell/GHC. No >> > matter how much I optimize my Haskell code my program still seems to run >> > slow, which leads me to beleive that Marshalling is painfully slow. >> > >> > Does anyone know a way I can test this and fix it? >> >> What kind of marshalling are you referring to? >> >> /M >> >> -- >> Magnus Therning (OpenPGP: 0xAB4DFBA4) >> magnus@therning.org Jabber: magnus@therning.org >> http://therning.org/magnus identi.ca|twitter: magthe > > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
