On 1 October 2010 10:33, Fernando olivero <fernando.olivero@usi.ch> wrote:
Just a thought,
I would say that Lukas Helvetia framework could be used here,  to cleanly embed C++, C or whatever you like  syntax into the existing Smalltalk ambient.
Yes, I like the idea of using Helvetia. I would be cool to invent some kind of platform-neutral assembler language. If one likes to write C or C++ , it would be cool too.
So in the background NativeBoost would behave more uniformly, because everything in the end is smalltalk code.
Fernando
On Oct 1, 2010, at 8:39 AM, Schwab,Wilhelm K wrote:
Sig,
I'm pointing out that "do it all in Smalltalk" has limits, both in syntax (C++ is generally a better formula translator than Smalltalk; Smalltalk is better at expressing just about anything else) and in performance, unless you can stop boxing/unboxing the floats, which it sounds like you can't.
One performance penalty that I look forward to suffering is to have an external library calling into Pharo to do function evaluations. Â In most cases, the number of operations will be small and the convenience of having the code in the image will be most welcome.
Bill
......
________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Stephen Pair [stephen@pairhome.net] Sent: Thursday, September 30, 2010 11:33 AM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] NativeBoost and Cog. A working protype.
On Wed, Sep 29, 2010 at 11:41 PM, Igor Stasenko <siguctua@gmail.com<mailto:siguctua@gmail.com>> wrote: On 30 September 2010 06:20, Schwab,Wilhelm K <bschwab@anest.ufl.edu<mailto:bschwab@anest.ufl.edu>> wrote:
One really crazy idea: inline C. Â Is there any way that one could put C code into a method, have it compiled and captured somehow as part of the image? Â Perhaps I am underestimating Cog and will soon not need to bother with stuff like this, but a recent addition was
void LogOnePlus(double * data, unsigned long size) /* Â Â Â Add one and take log10() over the buffer; in-place transformation! */ { Â Â Â for(unsigned long i=0; i<size; i++){ Â Â Â data[i] = log10(data[i]+1); Â Â Â } }
That's a simple calculation, but do it millions of times and it adds up. Â Even if Cog is sufficiently far reaching to translate such things, there are still times when C/C++ does a far nicer job of translating formulas than does Smalltalk. Â Like I said, it's a crazy idea, and if I have to choose, I'd rather have callbacks :)
Of course its possible. After porting C parser/compiler into smalltalk :) Or perhaps some meta-language which looks like C, but which easier to translate to native code.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.