[squeak-dev] Fun with spock (NativeBoost FFI)

Igor Stasenko siguctua at gmail.com
Sun May 13 22:49:24 UTC 2012


On 14 May 2012 00:03, Lawson English <lenglish5 at cox.net> wrote:
> [pharo-project list added back in]
>
>
> On 5/13/12 1:34 PM, Nicolas Cellier wrote:
>>
>> [100000 primeSwingFactorial] timeToRun 3411 [100000 factorial] timeToRun
>> 61219 So gmp is still 40x faster than a reasonably optimized Smalltalk
>> factorial... I think that's fair, because gmp is highly optimized. Since
>> cost is dominated by LargeInteger arithmetic, and since Smalltalk
>> LargeInteger arithmetic in primitives still operates on bytes, I'm not so
>> surprised of the gap... I'd like to see a 64bit image operating on 32 bits
>> positive integers digits, that would already be a progress... Nicolas
>
>
> For me, the most interesting thing would be to figure out how to integrate
> such external libraries more tightly into the language syntax.
>
> Right now,   x :=  3.14159... always creates a Float, which is stored as a
> double.
>
> x class ===> Float.
>
> What if I wanted to generate a gmplib floating point number (or rational or
> large integer) automatically when the gmplib binding is available?
>
> Could I implement something that makes x a GMPfpWrapper if extra digits are
> supplied?
> e.g.:
>
> x := 3.14159265358979323846264338327950288419716939937510.
>
> x class ===> GMPfpWrapper.
>
> NativeBoost allows one to cascade calls to external libraries if you wrap
> them in assembly language in the method. High speed, aribrary-precision
> floating point complex number arithmetic, can be accomplished that way (no
> examples yet sorry, still learning) as well as more complicated stuff. I'm
> hoping to make a proof-of-concept mandlebrot set Morph that can zoom in
> arbitrarily. 32 bit floats limit the resolution terribly.
>
> So...
>
> What can be done to better integrate such libraries? I browsed the Parser
> and other classes but didn't understand what I was seeing well enough to
> figure out how to begin.
>
See SqNumberParser.
this is the guy who used by Parser to parse number literals.

>
>
>
> L
>
> --
> Squeak from the very start (introduction to Squeak and Pharo Smalltalk for
> the (almost) complete and compleate beginner).
> https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all
>
>



-- 
Best regards,
Igor Stasenko.


More information about the Squeak-dev mailing list