Re: Performance of RevMedia on matrix diagonalization

2009-08-28 Thread Piero Ugliengo
Dear Viktoras, thanks a lot for the suggestions. Yes VB is compiled
(although in a sort of p-code) and it isexpected to be faster than any
scripting language. I did't try to do what you have suggested because I am
not
mastering other languages but VB6 and FORTRAN. I am also convinced that
trying to rewrite matrix algebra using
the very fast routines provided natively by Revolution will improve the
matters a lot. As usual, because I am not
a professional in this field, I have to find some time to do that!
Cheers
Piero

2009/8/27 viktoras d. vikto...@ekoinf.net

 Hi Piero,

 declaring local/global variables in functions and handlers should slightly
 add to speed. Populating arrays in advance with zeros so that array size
 won't change inside loops might also be of some value. However, please
 correct me if I am wrong, VB6 is compiled while Revolution is interpreted,
 therefore much slower. Did you try implementing same algorithm in other
 interpreted languages (javascript, php, perl, etc?) it would be interesting
 to do some benchmarking :-)

 Using native functions: matrixMultiply(firstArray, secondArray),
 transpose(array) where possible would also increase speed as they are really
 fast.

 Best wishes
 Viktoras

 Piero Ugliengo wrote:

 I am completely new to Revolution. I have downloaded the RevMedia alpha
 version and played a bit with it. I was impressed by how fast I was able
 to
 port a little VB6 code to RevMedia. This code diagonalizes a symmetric
 matrix using the Jacobi algorithm. I checked against the VB6 code and I
 got
 exactly the same results in the same number of iterations so that numerics
 is the same. However the RevMedia code is at least one order of magnitude
 slower than the VB6 one. For instance a 50x50 matrix is diagonalized in a
 couple of seconds in VB6 and it tooks more than a minute on RevMedia. I
 know
 that RevMedia is not meant for numerical intensive calculations; however,
 I
 would like to use it in a scientific teaching context so some power is
 needed. I wonder if anybody much expert than me can try the code using the
 most powerful Revolution Studio and if there is a clever way to deal with
 matrix algebra.
 The link to download the rev script is here:

 http://sites.google.com/site/pierougliengo/download-1/test.rev?attredirects=0

 
 http://sites.google.com/site/pierougliengo/download-1/test.rev?attredirects=0
 One
 can set the size of the matrix in the onmouse routine.
 Thanks a lot
 _
 Piero Ugliengo




 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
Prof. Piero Ugliengo
University of Torino
Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
ITALY
Phone: +39-011-670.4596
FAX:   +39-011-236.4596
E-mail:  piero.uglie...@unito.it
Home page:
http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show?_id=ugliengosort=DEFAULTsearch=hits=70
MOLDRAW: http://www.moldraw.unito.it
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Performance of RevMedia on matrix diagonalization

2009-08-28 Thread Piero Ugliengo
Hi Bernard, you are certianly right about RB. Indeed I am following their
developmentduring the years. I am pretty sure that the same code will be
probably faster in RB than in VB6
but I have yet to decide to buy their compiler.
As you said, what is attractive in RevMedia is its free character and the
fact that one can
write a trully portable app running within any browser. It is also rather
easy to
adopt as a language for teaching programming concepts to people in the
scientific field without
the effort needed with Java or C++. Python is certainly a beautiful language
extremely reach
in features and ad hoc libraries and can be adopted as a general purpose
language also
in a scientific context (Numpy will solve almost all numerical aspects). On
the other hand
I still have to find an easy way to deploy to a final user a complex Python
application which would
be straightforward to install on his/her computer.
Cheers
Piero

2009/8/28 Bernard Devlin bdrun...@gmail.com

 Viktoras,

 Maybe the wording in the IDE (and maybe the docs) is misleading.
 After all, the button in the script editor says 'compile', not just
 'save' or 'check syntax'.  It might very well be that it is compiled
 into some form of p-code that doesn't mean that it needs to be
 re-compiled each time the script inside a control is called.  (I
 believe that Python and other scripting languages also compile down to
 some form that doesn't require recompilation - I know that REXX used
 to do this).

 If it is compiled then one might well have an expectation that it
 would perform at speeds near to those of VB.  After all, Java is
 compiled to byte code and it performs pretty well these days.
 (Although it hardly seems reasonable to expect a company the size of
 RunRev to be able to optimize cross-platform execution the way that a
 company the size of Sun [with additional help/stimulus from companies
 like IBM/Oracle]).

 It might also be interesting/useful for Piero to implement his code in
 RealBasic.  Since it is so close to VB it should be fairly trivial.
 After all, RB  is cross platform and from a small company too.
 Although if Piero is interested in delivering content through a
 browser, then RB may not be of much interest to him even if it is
 faster.

 Bernard

 On Thu, Aug 27, 2009 at 8:30 PM, viktoras d.vikto...@ekoinf.net wrote:
  However, please
  correct me if I am wrong, VB6 is compiled while Revolution is
 interpreted,
  therefore much slower. Did you try implementing same algorithm in other
  interpreted languages (javascript, php, perl, etc?) it would be
 interesting
  to do some benchmarking :-)
 
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
Prof. Piero Ugliengo
University of Torino
Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
ITALY
Phone: +39-011-670.4596
FAX:   +39-011-236.4596
E-mail:  piero.uglie...@unito.it
Home page:
http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show?_id=ugliengosort=DEFAULTsearch=hits=70
MOLDRAW: http://www.moldraw.unito.it
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Performance of RevMedia on matrix diagonalization

2009-08-27 Thread Martin Blackman
I just tried it in Rev Studio. Changed 'N' to 50 under mouseup, it
took a shade over 30 seconds to diagonalise, I'm using a 4 year old
AMD 64 3200+.
I'll leave the optimising to others for now..


2009/8/27 Piero Ugliengo piero.uglie...@gmail.com:
 I am completely new to Revolution. I have downloaded the RevMedia alpha
 version and played a bit with it. I was impressed by how fast I was able to
 port a little VB6 code to RevMedia. This code diagonalizes a symmetric
 matrix using the Jacobi algorithm. I checked against the VB6 code and I got
 exactly the same results in the same number of iterations so that numerics
 is the same. However the RevMedia code is at least one order of magnitude
 slower than the VB6 one. For instance a 50x50 matrix is diagonalized in a
 couple of seconds in VB6 and it tooks more than a minute on RevMedia. I know
 that RevMedia is not meant for numerical intensive calculations; however, I
 would like to use it in a scientific teaching context so some power is
 needed. I wonder if anybody much expert than me can try the code using the
 most powerful Revolution Studio and if there is a clever way to deal with
 matrix algebra.
 The link to download the rev script is here:
 http://sites.google.com/site/pierougliengo/download-1/test.rev?attredirects=0

 http://sites.google.com/site/pierougliengo/download-1/test.rev?attredirects=0One
 can set the size of the matrix in the onmouse routine.
 Thanks a lot
 _
 Piero Ugliengo

 --
 Prof. Piero Ugliengo
 University of Torino
 Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
 ITALY
 Phone: +39-011-670.4596
 FAX:   +39-011-236.4596
 E-mail:  piero.uglie...@unito.it
 Home page:
 http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show?_id=ugliengosort=DEFAULTsearch=hits=70
 MOLDRAW: http://www.moldraw.unito.it
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Performance of RevMedia on matrix diagonalization

2009-08-27 Thread Mark Smith
I saw this over on the forum (the diagonalisation takes about twenty  
seconds on my MacBookPro with rev enterprise), and two things occur  
to me.


'Arrays' in revolution are actually hash tables, so are very nice for  
random access to elements, but will not be as efficient for  
sequential access as more traditional, fixed width arrays in other  
languages.

I suspect that this is the main speed issue with your eigen function.

Secondly, I understand that all numbers in revolution (which is an un- 
typed language) are floats - though there may be conversions to and  
from integers going on in the engine. I doubt that this will have any  
effect on the speed of your functions, but it's probably unneccessary  
to write '1.0' or '1.' - simply '1' will do, I think.


I think that using the a[i][j] approach instead of a[i,j] might get  
you maybe 10% more speed, but then you'd have to convert to a[i,j]  
anyway in order to use the built in matrixmultiply and transpose  
functions (this should be updated, I'd have thought).


My maths is nowhere near good enough to suggest mathematical  
optimisations (which you might not want for educational purposes,  
anyway) and I can't see any obvious optimisations to make in the code  
you've written.


Hopefully, someone here will be able to be more helpful, but this may  
be one of those things that revolution simply isn't best suited for :(


Best,

Mark Smith


On 27 Aug 2009, at 08:16, Piero Ugliengo wrote:

I am completely new to Revolution. I have downloaded the RevMedia  
alpha
version and played a bit with it. I was impressed by how fast I was  
able to

port a little VB6 code to RevMedia. This code diagonalizes a symmetric
matrix using the Jacobi algorithm. I checked against the VB6 code  
and I got
exactly the same results in the same number of iterations so that  
numerics
is the same. However the RevMedia code is at least one order of  
magnitude
slower than the VB6 one. For instance a 50x50 matrix is  
diagonalized in a
couple of seconds in VB6 and it tooks more than a minute on  
RevMedia. I know
that RevMedia is not meant for numerical intensive calculations;  
however, I

would like to use it in a scientific teaching context so some power is
needed. I wonder if anybody much expert than me can try the code  
using the
most powerful Revolution Studio and if there is a clever way to  
deal with

matrix algebra.
The link to download the rev script is here:
http://sites.google.com/site/pierougliengo/download-1/test.rev? 
attredirects=0


http://sites.google.com/site/pierougliengo/download-1/test.rev? 
attredirects=0One

can set the size of the matrix in the onmouse routine.
Thanks a lot
_
Piero Ugliengo

--
Prof. Piero Ugliengo
University of Torino
Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
ITALY
Phone: +39-011-670.4596
FAX:   +39-011-236.4596
E-mail:  piero.uglie...@unito.it
Home page:
http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show? 
_id=ugliengosort=DEFAULTsearch=hits=70

MOLDRAW: http://www.moldraw.unito.it
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Performance of RevMedia on matrix diagonalization

2009-08-27 Thread Piero Ugliengo
Dear Mark, thanks a lot for the advise. Things like 1.0 istead of 1 were
just my ignorance of the language.On the other hand I thought that the
syntax a[i][j] instead of the more readable a[i,j] was imposed by the
language.
Cheers
Piero

2009/8/27 Mark Smith li...@futilism.com

 I saw this over on the forum (the diagonalisation takes about twenty
 seconds on my MacBookPro with rev enterprise), and two things occur to me.

 'Arrays' in revolution are actually hash tables, so are very nice for
 random access to elements, but will not be as efficient for sequential
 access as more traditional, fixed width arrays in other languages.
 I suspect that this is the main speed issue with your eigen function.

 Secondly, I understand that all numbers in revolution (which is an un-typed
 language) are floats - though there may be conversions to and from integers
 going on in the engine. I doubt that this will have any effect on the speed
 of your functions, but it's probably unneccessary to write '1.0' or '1.' -
 simply '1' will do, I think.

 I think that using the a[i][j] approach instead of a[i,j] might get you
 maybe 10% more speed, but then you'd have to convert to a[i,j] anyway in
 order to use the built in matrixmultiply and transpose functions (this
 should be updated, I'd have thought).

 My maths is nowhere near good enough to suggest mathematical optimisations
 (which you might not want for educational purposes, anyway) and I can't see
 any obvious optimisations to make in the code you've written.

 Hopefully, someone here will be able to be more helpful, but this may be
 one of those things that revolution simply isn't best suited for :(

 Best,

 Mark Smith



 On 27 Aug 2009, at 08:16, Piero Ugliengo wrote:

  I am completely new to Revolution. I have downloaded the RevMedia alpha
 version and played a bit with it. I was impressed by how fast I was able
 to
 port a little VB6 code to RevMedia. This code diagonalizes a symmetric
 matrix using the Jacobi algorithm. I checked against the VB6 code and I
 got
 exactly the same results in the same number of iterations so that numerics
 is the same. However the RevMedia code is at least one order of magnitude
 slower than the VB6 one. For instance a 50x50 matrix is diagonalized in a
 couple of seconds in VB6 and it tooks more than a minute on RevMedia. I
 know
 that RevMedia is not meant for numerical intensive calculations; however,
 I
 would like to use it in a scientific teaching context so some power is
 needed. I wonder if anybody much expert than me can try the code using the
 most powerful Revolution Studio and if there is a clever way to deal with
 matrix algebra.
 The link to download the rev script is here:
 http://sites.google.com/site/pierougliengo/download-1/test.rev
 ?attredirects=0

 http://sites.google.com/site/pierougliengo/download-1/test.rev
 ?attredirects=0One
 can set the size of the matrix in the onmouse routine.
 Thanks a lot
 _
 Piero Ugliengo

 --
 Prof. Piero Ugliengo
 University of Torino
 Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
 ITALY
 Phone: +39-011-670.4596
 FAX:   +39-011-236.4596
 E-mail:  piero.uglie...@unito.it
 Home page:
 http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show
 ?_id=ugliengosort=DEFAULTsearch=hits=70
 MOLDRAW: http://www.moldraw.unito.it
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution


 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution




-- 
Prof. Piero Ugliengo
University of Torino
Dip. Chimica IFM,  Via P. Giuria, 7 I-10125 Torino
ITALY
Phone: +39-011-670.4596
FAX:   +39-011-236.4596
E-mail:  piero.uglie...@unito.it
Home page:
http://web086.unito.it/cgi-bin/chimifm/persone.pl/Show?_id=ugliengosort=DEFAULTsearch=hits=70
MOLDRAW: http://www.moldraw.unito.it
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Performance of RevMedia on matrix diagonalization

2009-08-27 Thread viktoras d.

Hi Piero,

declaring local/global variables in functions and handlers should 
slightly add to speed. Populating arrays in advance with zeros so that 
array size won't change inside loops might also be of some value. 
However, please correct me if I am wrong, VB6 is compiled while 
Revolution is interpreted, therefore much slower. Did you try 
implementing same algorithm in other interpreted languages (javascript, 
php, perl, etc?) it would be interesting to do some benchmarking :-)


Using native functions: matrixMultiply(firstArray, secondArray), 
transpose(array) where possible would also increase speed as they are 
really fast.


Best wishes
Viktoras

Piero Ugliengo wrote:

I am completely new to Revolution. I have downloaded the RevMedia alpha
version and played a bit with it. I was impressed by how fast I was able to
port a little VB6 code to RevMedia. This code diagonalizes a symmetric
matrix using the Jacobi algorithm. I checked against the VB6 code and I got
exactly the same results in the same number of iterations so that numerics
is the same. However the RevMedia code is at least one order of magnitude
slower than the VB6 one. For instance a 50x50 matrix is diagonalized in a
couple of seconds in VB6 and it tooks more than a minute on RevMedia. I know
that RevMedia is not meant for numerical intensive calculations; however, I
would like to use it in a scientific teaching context so some power is
needed. I wonder if anybody much expert than me can try the code using the
most powerful Revolution Studio and if there is a clever way to deal with
matrix algebra.
The link to download the rev script is here:
http://sites.google.com/site/pierougliengo/download-1/test.rev?attredirects=0

http://sites.google.com/site/pierougliengo/download-1/test.rev?attredirects=0One
can set the size of the matrix in the onmouse routine.
Thanks a lot
_
Piero Ugliengo

  


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Performance of RevMedia on matrix diagonalization

2009-08-27 Thread Bernard Devlin
Viktoras,

Maybe the wording in the IDE (and maybe the docs) is misleading.
After all, the button in the script editor says 'compile', not just
'save' or 'check syntax'.  It might very well be that it is compiled
into some form of p-code that doesn't mean that it needs to be
re-compiled each time the script inside a control is called.  (I
believe that Python and other scripting languages also compile down to
some form that doesn't require recompilation - I know that REXX used
to do this).

If it is compiled then one might well have an expectation that it
would perform at speeds near to those of VB.  After all, Java is
compiled to byte code and it performs pretty well these days.
(Although it hardly seems reasonable to expect a company the size of
RunRev to be able to optimize cross-platform execution the way that a
company the size of Sun [with additional help/stimulus from companies
like IBM/Oracle]).

It might also be interesting/useful for Piero to implement his code in
RealBasic.  Since it is so close to VB it should be fairly trivial.
After all, RB  is cross platform and from a small company too.
Although if Piero is interested in delivering content through a
browser, then RB may not be of much interest to him even if it is
faster.

Bernard

On Thu, Aug 27, 2009 at 8:30 PM, viktoras d.vikto...@ekoinf.net wrote:
 However, please
 correct me if I am wrong, VB6 is compiled while Revolution is interpreted,
 therefore much slower. Did you try implementing same algorithm in other
 interpreted languages (javascript, php, perl, etc?) it would be interesting
 to do some benchmarking :-)

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution