Additional language features

Christian Mayer mail at ChristianMayer.de
Sat Mar 5 15:15:46 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Am 05.03.2011 23:38, schrieb David Herman:
>> But I miss the linear algebra library to go with it.
> 
> Can you send references to example libraries for other systems that you would like to see?

A big favourite of mine (I'm biased, though...) is the Eigen2 library
(LGPL3+):
  http://eigen.tuxfamily.org/index.php?title=Main_Page

Using the small, fixed size subset of that lib and exporting the
interface to ECMAScript should give perfect coverage - and an optimal
implementation.

But looking at the (much older) "SG" lib of PLIB:
  http://plib.sourceforge.net/sg/index.html
gives a nice overview of every function that is needed from linear
algebra for doing 3D graphics work. (It was created for OpenGL as it
came to the personal computers)

If the licence of the ECMAScript implementation allows it, I would just
take Eigen2 (or Eigen3)...

>> And, to make sure that a highly optimized implementation (SIMD
>> instructions...) is possible, the language standard should predefine the
>> most common types (i.e. Vec2Dfloat, Vec3Dfloat and Vec4Dfloat) and
>> supply a library to handle those (especially the scalar product, matrix
>> vector product and the matrix matrix product)
> 
> Yeah, a matrix library would be nice to have. OTOH, we tend to avoid putting too many libraries in the standard, preferring instead to let the community experiment with libraries. Your point about optimization is good, though: a matrix library could be highly optimized by the JS engines, more so than many other kinds of libraries. Still, in the end it comes down to resources: do we have the time and people to spec the library; do implementors have the resources to implement the library; or does someone have the resources to write an open source implementation that could potentially be shared by the many VM's...

Exactly. It might be possible to use the prototype functionality to
provide a smooth fallback for implementations that don't provide that
lib yet. But this library would extremely profit from a native
implementation.

BTW: The big break though the GeForce graphic cards brought, was that
those operations went from the CPU to the GPU.
So I think it would bring a big speed increase to bring that from
interpreted to compiled code...

As I wrote above, look at Eigen2 and just use it - it even comes with
SIMD support for best CPU utilisation and performance.
A specialisation for 2D, 3D and 4D as well as the Dynamic for the
generic case should do it.
All that you need (and even more...) should be documented at the page
  http://eigen.tuxfamily.org/dox-devel/QuickRefPage.html

If you include "Core" and perhaps "Geometry" you've got everything that
you need - at a very short time.
(Adding "LU" you've got enough to make 99% happy.)

> Thanks for your feedback!

Thanks for the good work.

(And I'm looking forward to use those features in my project! ;)

CU,
Christian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEAREIAAYFAk1yxCIACgkQoWM1JLkHou1S5QCdHHLrVRQqk07YSqguuEGh8DUq
0FEAn22WkJZDNzN69w8SPTOTmEQFLSl1
=oOY8
-----END PGP SIGNATURE-----


More information about the es-discuss mailing list