[squeak-dev] Fun with spock (NativeBoost FFI)
Lawson English
lenglish5 at cox.net
Sun May 13 22:03:40 UTC 2012
[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.
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
More information about the Squeak-dev
mailing list
|