-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Let pycaml be your friend.
http://pycaml.sourceforge.net/ I never ended up using it in the end (I just decided to do everything in ocaml) but it looked promising. Sounds like what you need. If you end up using it, please tell us how it went. Peng On Saturday 26 May 2007 05:37, bullockbefriending bard wrote: > (Apologies in advance for being a complete Ocaml newbie!) > > I've done all the requisite profiling and thought fairly deeply about > the efficiency of my Python code, but am still going to have to speed > up the innermost guts of what I am doing. > Essentially, I need to pass a list of 6-tuples containing only > integers to my new sadly necessary super-fast compiled language > function which i am not looking forward to writing: > > input: [(1,2,3,4,5,6), (7,8,9,10,11,12),...] > > and after much thrashing of processor resources, return data which > looks like this to the Python calling environment: > > output: [( (1, 2), (1,), (12,), (13), (1, 7, 11), (9,) ), ( another > nested tuple like preceding one ), .... ] > > Each member of the returned list is a tuple containing six tuples, > and > each of those six tuples has at least one integer member. It would > also > be acceptable for the return values to be entirely nested lists > instead of having the two innermost sequence types as tuples. > > Ocaml is certainly going to be fast enough, and I'm sufficiently tired > of C++ and especially STL compiler error messages to want to learn > something new for when I have a need for speed. Essentially the > algorithm I am going to speed up requires no high level data > structures more complex than integer set and a vector which can > contain objects encapsulating an array or tuple of the aforementioned > integer sets plus one or two integer variables. All this should be > within my capability to pick up fairly quickly despite my total > ignorance of Ocaml, I hope :) > > Anyway, I can probably very quickly figure out some hacked way to get > the data from Python into my function given that in the worst case I > could take > advantage of the knowledge that each input tuple always has 6 > elements, and simply pass in a big array of ints. Yes, I know this is > a bit retarded, but I'm talking worst case assuming on very tight > schedule and no time to delve deeply into SWIG or whatever. Similarly > it wouldn't be too difficult to return the result as the mother all > of > all strings which i could then parse fairly easily. > > However, I hope someone reading this will be able to tell me that I'm > being a total pessimist and that in fact it isn't very difficult to > do > what I want to do using SWIG or some other interface method. I'm not > asking for a complete solution, more like some general pointers from > someone who has actually done something similar before. After that > I'll RTFM and won't ask too many more annoying questions. Promise! :) > > TIA > > as the guts instead of C++, I'd be happy to know about it. > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.2 (GNU/Linux) iD8DBQFGWCasfIRcEFL/JewRAl+WAKDHc2DFh/0iz3MYOSvHSWSDBTlYNwCfRdPQ TQUbCIPBFHoPEpL/2myEt20= =HUOz -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ocaml-developer" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/ocaml-developer?hl=en For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html -~----------~----~----~----~------~----~------~--~---
