Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm not a software expert but need to outsource a web-based scientific GUI application, and I'm considering Adobe Flex. My math routines are currently in Javascript and C/C+. Having no experience with Flex, was hoping someone could help me understand what options are available for performing (preferably fast and efficient) CLIENT-side calculations. That is, can Flex interact with Javascript and/or C easily? If not, is actionscript or other language preferred? Downsides/tradeoffs? Need functions like LOG10, LN, SQRT, and would be nice to also have the error function (ERF) and complementary error function (ERFC), although I may be able to derive these last two from more basic functions if necessary.


share|improve this question
add comment

closed as not constructive by gnat, MichaelT, Martijn Pieters, GlenH7, Joris Timmermans May 6 '13 at 14:09

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

up vote 2 down vote accepted

Interfacing with JavaScript is really easy. This article explains all the details.

Generally, you can expect ActionScript 3 to be faster, because unlike JavaScript, it is strictly typed and can uses that type information at runtime. Google V8 can possibly keep up, but it would surprise me if it were signifficantly faster.
However you may want use haXe instead, because it generally compiles to faster bytecode and allows the use of the alchemy opcodes for direct memory access, which are not available in ActionScript 3. There's also a lot of other good reasons to use haXe.
For very specific calculations, you can possibly use PixelBender.
The last option for Flash Player is using alchemy itself, but it is far from perfect.

If you want the speed of C/C++, you might want to create a native daemon you can connect to over TCP, push the parameters and retrieve the results.

share|improve this answer
Thanks back2dos. If I understand correctly, speed increases going from ActionScript3 to haXe to C/C++. Are all of these valid options for client-side computations? When you say C/C++ over TCP, I immediately think network connection, but maybe I'm wrong. I need these computations to be on the client computer. –  gkdsp Feb 16 '11 at 21:52
@gkdsp: Yes, concerning performance you understand correctly. What I suppose you mean is TCP/IP (TCP over Internet Protocol). However, a daemon, that runs locally can bind a local port, to which the Flash client connects doesn't actually use the network, but still TCP. To the flash client it is relatively transparent, whether the "server" is on the same machine or not, to the daemon it is completely transparent. So while the protocol is usually used for streaming over a network, you can just as well use it to stream data between 2 applications on the same machine. –  back2dos Feb 16 '11 at 23:28
Great back2dos, then C/C++ can communicate with Flex locally. –  gkdsp Feb 16 '11 at 23:49
add comment

I'd say that sencha is a good alternative for Flex, because it doesn't need the flashplayer and is also suitable for mobile. It's not strongly typed though and JSON based.

share|improve this answer
Sorry, I see my answer is off topic because your issue is number crunching and Sencha is essentially javascript. –  Olivier de Jonge Aug 1 '12 at 9:26
add comment

I would look into R which is a math oriented programming language.

R is a language and environment for statistical computing and graphics. It is a GNU project which is similar to the S language and environment which was developed at Bell Laboratories (formerly AT&T, now Lucent Technologies) by John Chambers and colleagues. R can be considered as a different implementation of S. There are some important differences, but much code written for S runs unaltered under R.

R provides a wide variety of statistical (linear and nonlinear modelling, classical statistical tests, time-series analysis, classification, clustering, ...) and graphical techniques, and is highly extensible. The S language is often the vehicle of choice for research in statistical methodology, and R provides an Open Source route to participation in that activity...

share|improve this answer
wow, this totally disregards the question. –  JoséNunoFerreira Feb 16 '11 at 19:44
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.