[Prev][Next][Index][Thread]
Re: performance for scientific computing
On Wednesday, August 1, 2001, at 10:30 am, Sébastien de Menten wrote:
> That is not a problem if one can write an extension of array to do that
> efficiently.
> But is it possible to extend Dylan in C or C++ ?
GD and FD aren't scripting language-style implementations of Dylan, so
you can't write C/C++ extentions as you would for Perl or AppleScript.
As both GD and FD are compiled implementations of Dylan, switching to
another compiled language then paying the overhead of object
translation, calling convention switching, etc. isn't the best way of
doing things.
You extend Dylan in itself mostly, and making a new collection type is a
good example of that.
> And what about active memory management ?
Any Dylan object gets Garbage Collected. I think you can interact a
little with the Garbage Collector in GD, so you could flush unused
objects, but I'm not sure about this (or what, if any, GC interaction is
available in FD).
For objects taken from C or other languages, the program will need its
own strategy for dealing with the joys of memory management. FD calls an
objects finalizer before it is GC'd, so deallocation code can be put
there.
> If I want to create a new class (like <array> or <vector>)
> <numerical-array>
> which would be more
> adapted to the situation, how do I write it ?
Make the class and its iteration protocol. Gwydion Dylan has several
non-standard collection types in it. I can't remember whether <array> or
<vector> are sealed (non-extensible for efficiency reasons) or not. Does
anyone have a tutorial or a good reference on making your own
collections?
One built-in feature of the language is that you can define
"limited"collection objects: a limited array or vector of a particular
numeric type might be more efficient than an unconstrained type.
> I think the last point should be feasible (computing C=A*A+cos(A)). The
> point which disturbs me the most is the creation of new classes (where I
> need to redefine the allocation of memory,etc...) in C or C++ and their
> interface with Dylan
Just do the new classes in Dylan and optimize the code, unless I'm
missing something.
- Rob.
--
"The idea behind Dylan—to offer a range of dynamism appropriate to each
piece of an application—feels right, and after using Dylan you will
become frustrated with C++ and Java."
- Peter Norvig, Software Developer Magazine.
References: