Get 20M+ Full-Text Papers For Less Than $1.50/day. Start a 14-Day Trial for You or Your Team.

Learn More →

Finding the Best Efficiency in Actionscript Based Web Applications on Example of FFT Algorithm

Finding the Best Efficiency in Actionscript Based Web Applications on Example of FFT Algorithm This paper focuses on finding the most efficinet way of performing local and remote computations with web application based on ActionScript language. Tests involve comparsion of several scenarions which uses pure ActionScript, ActionScript with Alchemy project and ActionScript connecting with C application over AMF protocol and with FileReference class. KEYWORDS: benchmark, flex, actionscript, php, amf, c, alchemy, eeg Introduction In last two decades the rapid development of computational neuroscience has been observed. Thanks to the increasing computational power and availability of clusters, grids and common desktop PCs nowadays it is much easier to design, create and simulate quite sophisticated models of neural networks with high degree of complexity [1, 2]. In the other hand the current problems of neurocybernetics do not only concentrate on the modeling and simulation but also deal with real experimental data that has to be processed, analysed and visualised [3, 4]. Throughout the world, in the laboratories of experimental psychology, the huge amount of data is collected in electroencephalographic experiments [5-7] and applications extending the potential of the EEG-OEM software are always in demand. Recently in the Division of Complex Systems and Neurodynamics of the Institute of Computer Science of Maria Curie-Sklodowska University a software for EEG data visualisation was developed [8]. Taking into account that the application may be extended with some EEG analysis features it was decided to do a research in the area of efficiency in ActionScript based web applications. Creating web applications is reasonable when the point is to have software that does not need to be installed and is accessible from any machine with internet connection. Mockup designers [9], UML diagram creators [10] or various media converters [11] can be considered as examples. Unfortunately web technologies are often significantly slower than desktop ones. Therefore if a web application performs complex computations then the biggest pressure should be put on finding the most efficient way to do them. In case of this paper for programming platform Adobe Flex was chosen mainly because of it's popularity and research project Alchemy [12] which brings new capabilities in the area of computations efficiency. It was decided that Fast Fourier Transform algorithm will be benchmarked in three scenarios: pure ActionScript, ActionScript with Alchemy library and ActionScript communicating with C application by HTTP protocol (Figure 1). Figure 1. Computation scenarios. Recording and fast analysis of signals originating from the brain, like EEG, plays key role e.g. in Brain-Computer Interfaces (BCIs) [13, 14]. This technology transforms them into messages or commands for the controlled devices, as the "linking device" between the human brain and the computer [15]. Particular attention is focused on new solutions (e.g. neuroprostheses) for people with paralysis, people with communication disorders and amputees for communication and control purposes [16, 17]. Applications For needs of this paper two applications were developed: sinusoidal signal generator and FFT benchmark [18]. Signal generator provides mechanisms to create sinusoidal signals or sums of sinusoidal signals with defined frequency and phase. It also allows to set signal generation parameters such as: time, samples per second and number of samples. Each of this parameters can be locked so if samples per second are locked then changing signal duration will affect only number of all signal samples (Figure 2). Figure 2. Sinusoidal signal generator. Generated signal is saved to a binary file with "sig" extension. Sig file format is defined as following: 4 bytes for sampling frequency, 4 bytes for number of component signals, then proper amount of 8 bytes blocks describing frequency and phase of component signals, 4 bytes for number of samples and a block of 2 bytes samples. Sig file has "Little Endian" byte order. FFT benchmark performs all the tests presented in this paper. It consists of buttons bar and 3 charts. Buttons bar is used to upload input data and run benchmarks. Charts display input signal, FFT signal and time that was taken to run chosen method (Figure 3). Figure 3. FFT benchmark. ActionScript ActionScript is an object-oriented language based on ECMA Script (the same standard that is the basis for JavaScript). ActionScript is compiled to ActionScript Bytecode (ABC) which is interpreted by ActionScript Virtual Machine (AVM). Expectations about efficiency of ActionScript were low. It was sure that there are better alternatives and ActionScript as interpreted language will not win the competition. In consequence it was benchamarked rather for formality [19]. Figure 4. ActionScript FFT calculations times. Alchemy Alchemy is Adobe project that allows to compile C/C++ code to ActionScript 3.0 bytecode. To achieve that Alchemy uses LLVM (Low Level Virtual Machine) which is compiler framework with modular backends and frontends [20]. A frontend is a C/C++ compiler that takes C/C++ sources and compiles it to LLVM intermediate bytecode. Backend is a code generator that compiles the LLVM intermediate bytecode to x86 native code. In other words LLVM compiler takes code in many different languages and compile it into simple instructions that are platform neutral. Then, anyone can write a backend to LLVM that can take LLVMs simple instructions and turn them into actual executables for a given platform. Alchemy reuses the C/C++ LLVM frontend and provides it's own Adobeauthored backend which instead of compiling the LLVM bytecode to x86 native code, compiles it to AVM2 (ActionScript Virtual Machine 2) bytecode where AVM2 is a part of Flash Player and is able to interpret a ActionScript bytecode [21] (Figure5). Figure 5. Alchemy pipeline. Taking into account that ActionScript and Alchemy output runs on the same AVM2 and that abstraction level of the AVM2 bytecode is a lot higher than the the LLVM bytecode, it would mean that all operations which are done in C/C++ must be wrapped with mechanisms which are available in AVM2. In such situation using Alchemy would be slower than ActionScript since it is always better to fine-tune ActionScript code than let it be done by Alchemy where it is not known exactly how things are translated from C/C++ to AVM2 bytecode. Alchemy achieves considerably better performance than ActionScript 3.0 thanks to special opcodes which were introduced in FlashPlayer10. These Opcodes are not accessible form standard ActionScript 3.0 because they provide access to a new memory that is completely segregated from the memory used for ActionScript objects. The new opcodes help implement the C memory model, an untyped linear array of bytes. Programs using this model are faster than programs using the memory model of ActionScript 3.0, a collection of interlinked, typed objects. Besides that for operations involving ByteArrays there are opcodes that are optimised for performance, which the ASC (ActionScript Compiler) does not generate today. Other advantage for the Alchemy is that it uses LLVM to optimize the code it generates what results in bytecode that is often better than the one produced by ASC. It is possible because LLVM C compiler performs many code optimizations that the ASC does not do yet. First stable version of the Alchemy was introduced at Adobe Max Conference 2008 and was released on 10th December 2008. Before that it was known under codename FlaCC. Since that time it was successfully used in various projects: polygon triangulation library [22], 3D engine Alternativa3D [23], PDF generator PurePDF [24] or JPEG encoder [25] which made possible to encode bitmaps 20 times faster than in case of standard ActionSctipt library [26]. Benefits in performance area achieved in those projects made Alchemy worth taking a closer look. Figure 6. ActionScript + Alchemy FFT calculations times. Using more than 131072 samples caused Alchemy to randomly throw errors connected with memory management. Alchemy is still a beta product and some underdevelopments should be expected. ActionScript with C/C++ application ActionScript does not provide any support for communication with C applications therefore some third party had to be used. Three sub-scenarios were tested: two of them involve AMF protocol and the last one relied on FileReference class [27] (Figure 7). According to data loading comparison for Rich Internet Applications technologies created by James Ward AMF protocol offers the best performance [28]. AMF is a binary format used to serialize ActionScript objects and send them between Flash client and a remote service. Two implementations of AMF protocol were tested: AMFPHP [29] and Zend AMF-PHP [30]. Figure 7. ActionScript - C communication methods. Zend AMF Zend version of AMF-PHP is officially supported by Adobe, it offers various complex functionalities as it is a part of Zend framework, an application framework for PHP and it has a group of experienced developers behind it. Figure 8. ActionScript + C (Zend AMF) FFT calculations times. Using more than 65532 samples caused Zend AMF to have problems with sending results back to Flex application. AMF AMF-PHP is a one-man project developed since 2003. It has focused our attention because it is claimed in the Flash community that it can be significantly faster than Zend AMF. Figure 9. ActionScript + C (AMF) FFT calculations times. Using more than 131072 samples caused AMF to have problems with sending results back to Flex application. FileReference Class In above AMF scenarios input data was send to PHP script which saved it to a binary file and than executed C application which read the file, did all computations and saved results to a output binary file. Next PHP read the output file and sent obtained data back to Flex application (Figure 10). Figure 10. ActionScript - C (AMF) pipeline. Taking into account that AMF is used to serialize ActionScript objects then if no complex objects but simple array of data is exchanged between Flex and C AMF can be removed from the communication pipeline without any consequences. In such sub-scenario bytes array is saved to a file from Flex, Flex runs PHP script which only executes C application after what Flex downloads C output file and parses it's content (Figure 11). Figure 11. ActionScript - C (FileReference) pipeline. Unlike both C (AMF) communications methods FileReference was reliable for all of provided input data sets. Figure 12. ActionScript + C (FileReference) FFT calculations times. It it interesting that in the most of the performed tests FileReference scenario resulted with similar times. After doing a more detailed time measures it was found out that most of the time used by this method is consumed for C calculations and downloading and parsing output data. For the last two input datasets time consumed by C application (includes execution from PHP script and time registration) exceeds time used for downloading and parsing output data (C to AS). Tabela 1. ActionScript - C (FileReference) detailed times in ms. Step/ samples AS to C C C to AS Total time 1024 5,79 147,08 403,2 556,07 2048 21,82 200,24 318,49 540,55 4096 5,28 188,97 344,35 538,6 8192 4,22 189,53 266,46 460,2 16384 6,39 201,27 367,51 575,17 32768 4,99 213,13 366,85 584,98 65532 6,28 289,07 300,63 595,98 131072 5,46 420,22 237,01 662,69 262144 6,52 670,39 553,4 524288 5,62 1219,44 857,47 1230,31 2082,53 Pure C application In addition, to have a complete "picture" C application without any wrapping scripts was tested. In general it is 2-3 times faster then Alchemy and C with FileReference method (Figure 13). Figure 13. C FFT calculations times. Benchmarks summary All the performed benchmarks considered time from passing input data to receiving useful output data in a form of array. Some of tested methods returned ByteArray which is a raw block of data that needs to be interpreted before it can be used any further. To treat all methods equally measuring computation time was stopped after achieving output data in form of ActionScript Array. Besides that each computation method was ran 100 times for each input data set and arithmetic mean was calculated to obtain resulting time. In order to avoid any influence from previous calculations all executions were separated with 1000 ms period of time. All tests presented in this paper were performed on Intel Core2Duo 2.66MHz machine with 2GB DDR2 800MHz RAM memory. Figure 14. Number of samples - time dependency for various computation methods. Conclusions The best performance for Flex web application was achieved with Alchemy project and C application with FileReference communication. Results in this cases were 2-3 times worse then in case of pure C application. ActionScript, as expected, had one of the longest computations times. Both AMF methods turned out to be the biggest disappointment because their times were significantly higher even than ActionScript times. It is visible especially in Zend AMF benchmarks. On the other hand it does not mean that the AMF methods are completely useless. They provide data type mapping mechanisms which are for sure very convenient in business logic where complex objects are exchanged between database and user interface. Alchemy and FileReference methods are not completely comparable since one is run on a local machine while the other on a remote machine. Regardles to that two important observations were made: Alchemy (in opposition to ActionScript) provides a way to greatly improve performance in flash-based applications, the most reasonable approach to build flash-based web applications, that perform complex computations, is to use C program running on a server-side and communicate with it by FileReference method. While both AMF and Alchemy approaches failed when big enough data was transferred FileReference worked well for all data packages. Besides that using server-side program hardware and software can be controlled and adjusted properly to achieve satisfying efficiency. Bibliography 1. Tadeusiewicz R. (2009) Theoretical Neurocybernetics. Warsaw University Publishers. 2. Tadeusiewicz R. (2009) Models of the nervous system elements as artificial neural networks. Chapter in Book "Theoretical Neurocybernetics". Warsaw University Publishers, 109-127. 3. Tadeusiewicz R. (2010) New trends in neurocybernetics. Computer Methods in Materials Science, 1(10):1-7. 4. Tadeusiewicz R. (1994) Problems of Biocybernetics. Polish Scientific Publishers (PWN), Warsaw. 5. Tadeusiewicz R. (2011) Informatyka i psychologia w spoleczestwie informacyjnym, ch. Neural Networks as Computational Tool with Interesting Psychological Applications [In Polish: Sieci neuronowe i inne systemy neurocybernetyczne jako narzdzia informatyczne o ciekawych zastosowaniach na gruncie psychologii]. AGH Publishers, 49-101, Kraków. 6. Tadeusiewicz R. (2010) ch. Modelling of the neural system elements with the neural networks use. On the paths of Neuroscience by Piotr Fracuz (ed.), KUL Publishers, 13-34. 7. Tadeusiewicz R. (2010) Computers in psychology and psychology in computer science, in Proceedings of the 2010 International Conference on Computer Information Systems and Industrial Management Applications (CISIM) With Applications to Ambient Intelligence and Ubiquitous Systems (V.S.e. Abraham A, Saeed K, ed.), IEEE, 34-38. 8. Wierzgala P, Wójcik GM. (2010) Signal visualisation software for Mindset MS1000 electroencephalograph. Bio-Algoritms and Med-Systems 1(13):83-87. 9. Online mockup builder: builds.balsamiq.com/b/mockups-web-demo/ (June, 2012) 10. Online UML diagrams creator: www.yuml.me (June, 2012) 11. Online media converter: www.media.io (June, 2012) 12. Adobe labs: labs.adobe.com/technologies/alchemy (June, 2012) 13. Mikolajewska E, Mikolajewski D. (2011) Interfejsy mózg-komputer ­ zastosowania cywilne i wojskowe. Kwartalnik Bellona, 2:123-133 (in Polish). 14. Mikolajewska E, Mikolajewski D. (2011) Neurorehabilitacja XXI wieku. Techniki teleinformatyczne. Impuls, 71-84, Kraków (in Polish). 15. Krusienski DJ, Grosse-Wentrup M, Galán F, Coyle D, Miller KJ, Forney E. et al. (2011) Critical issues in state-of-the-art brain-computer interface signal processing. J Neural Eng, 8(2). 16. Mikolajewski D, Mikolajewska E. (2011) Exoskeletons in neurological diseases - current and potential future applications. Adv Clin Exp Med, 20(2), 227-233. 17. Zanter TO, Kothe Ch. (2011) Towards passive brain-computer interfaces: applying brain-computer interface technology to human-machine systems in general. J Neural Eng, 8(2). 18. Neuroinformatic System for Science, Industry and Education: nessie.umcs.lublin.pl/EEG (June, 2012) 19. ActionScript Technology Center: adobe.com/devnet/actionscript.html (June, 2012) 20. The LLVM Compiler infrastructure: llvm.org (June, 2012) 21. Nicolas Cannasse weblog: www.ncannasse.fr/blog/adobe_alchemy (June, 2012) 22. Adobe Alchemy libraries: labs.adobe.com/wiki/index.php/Alchemy:Libraries:Shared (June, 2012) 23. Alternativa3D library: alternativaplatform.com/en/alternativa3d/ (June, 2012) 24. Pure PDF library: http://code.google.com/p/purepdf/ (June, 2012) 25. Alchemy JPEG encoder: segfaultlabs.com/devlogs/alchemy-asynchronous-jpegencoding (June, 2012) 26. Alchemy JPEG encoder performance tests: websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/ (June, 2012) 27. FileReference: help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/ FileReference.html (June, 2012) 28. Flex protocols comparison: http://www.jamesward.com/census2/ (June, 2012) 29. AMF PHP: http://amfphp.sourceforge.net/ (June, 2012) 30. Zend AMF: http://framework.zend.com/manual/en/zend.amf.introduction.html (June, 2012) http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Bio-Algorithms and Med-Systems de Gruyter

Finding the Best Efficiency in Actionscript Based Web Applications on Example of FFT Algorithm

Loading next page...
 
/lp/de-gruyter/finding-the-best-efficiency-in-actionscript-based-web-applications-on-4jKXg05rRB

References

References for this paper are not available at this time. We will be adding them shortly, thank you for your patience.

Publisher
de Gruyter
Copyright
Copyright © 2012 by the
ISSN
1895-9091
DOI
10.1515/bams-2012-0027
Publisher site
See Article on Publisher Site

Abstract

This paper focuses on finding the most efficinet way of performing local and remote computations with web application based on ActionScript language. Tests involve comparsion of several scenarions which uses pure ActionScript, ActionScript with Alchemy project and ActionScript connecting with C application over AMF protocol and with FileReference class. KEYWORDS: benchmark, flex, actionscript, php, amf, c, alchemy, eeg Introduction In last two decades the rapid development of computational neuroscience has been observed. Thanks to the increasing computational power and availability of clusters, grids and common desktop PCs nowadays it is much easier to design, create and simulate quite sophisticated models of neural networks with high degree of complexity [1, 2]. In the other hand the current problems of neurocybernetics do not only concentrate on the modeling and simulation but also deal with real experimental data that has to be processed, analysed and visualised [3, 4]. Throughout the world, in the laboratories of experimental psychology, the huge amount of data is collected in electroencephalographic experiments [5-7] and applications extending the potential of the EEG-OEM software are always in demand. Recently in the Division of Complex Systems and Neurodynamics of the Institute of Computer Science of Maria Curie-Sklodowska University a software for EEG data visualisation was developed [8]. Taking into account that the application may be extended with some EEG analysis features it was decided to do a research in the area of efficiency in ActionScript based web applications. Creating web applications is reasonable when the point is to have software that does not need to be installed and is accessible from any machine with internet connection. Mockup designers [9], UML diagram creators [10] or various media converters [11] can be considered as examples. Unfortunately web technologies are often significantly slower than desktop ones. Therefore if a web application performs complex computations then the biggest pressure should be put on finding the most efficient way to do them. In case of this paper for programming platform Adobe Flex was chosen mainly because of it's popularity and research project Alchemy [12] which brings new capabilities in the area of computations efficiency. It was decided that Fast Fourier Transform algorithm will be benchmarked in three scenarios: pure ActionScript, ActionScript with Alchemy library and ActionScript communicating with C application by HTTP protocol (Figure 1). Figure 1. Computation scenarios. Recording and fast analysis of signals originating from the brain, like EEG, plays key role e.g. in Brain-Computer Interfaces (BCIs) [13, 14]. This technology transforms them into messages or commands for the controlled devices, as the "linking device" between the human brain and the computer [15]. Particular attention is focused on new solutions (e.g. neuroprostheses) for people with paralysis, people with communication disorders and amputees for communication and control purposes [16, 17]. Applications For needs of this paper two applications were developed: sinusoidal signal generator and FFT benchmark [18]. Signal generator provides mechanisms to create sinusoidal signals or sums of sinusoidal signals with defined frequency and phase. It also allows to set signal generation parameters such as: time, samples per second and number of samples. Each of this parameters can be locked so if samples per second are locked then changing signal duration will affect only number of all signal samples (Figure 2). Figure 2. Sinusoidal signal generator. Generated signal is saved to a binary file with "sig" extension. Sig file format is defined as following: 4 bytes for sampling frequency, 4 bytes for number of component signals, then proper amount of 8 bytes blocks describing frequency and phase of component signals, 4 bytes for number of samples and a block of 2 bytes samples. Sig file has "Little Endian" byte order. FFT benchmark performs all the tests presented in this paper. It consists of buttons bar and 3 charts. Buttons bar is used to upload input data and run benchmarks. Charts display input signal, FFT signal and time that was taken to run chosen method (Figure 3). Figure 3. FFT benchmark. ActionScript ActionScript is an object-oriented language based on ECMA Script (the same standard that is the basis for JavaScript). ActionScript is compiled to ActionScript Bytecode (ABC) which is interpreted by ActionScript Virtual Machine (AVM). Expectations about efficiency of ActionScript were low. It was sure that there are better alternatives and ActionScript as interpreted language will not win the competition. In consequence it was benchamarked rather for formality [19]. Figure 4. ActionScript FFT calculations times. Alchemy Alchemy is Adobe project that allows to compile C/C++ code to ActionScript 3.0 bytecode. To achieve that Alchemy uses LLVM (Low Level Virtual Machine) which is compiler framework with modular backends and frontends [20]. A frontend is a C/C++ compiler that takes C/C++ sources and compiles it to LLVM intermediate bytecode. Backend is a code generator that compiles the LLVM intermediate bytecode to x86 native code. In other words LLVM compiler takes code in many different languages and compile it into simple instructions that are platform neutral. Then, anyone can write a backend to LLVM that can take LLVMs simple instructions and turn them into actual executables for a given platform. Alchemy reuses the C/C++ LLVM frontend and provides it's own Adobeauthored backend which instead of compiling the LLVM bytecode to x86 native code, compiles it to AVM2 (ActionScript Virtual Machine 2) bytecode where AVM2 is a part of Flash Player and is able to interpret a ActionScript bytecode [21] (Figure5). Figure 5. Alchemy pipeline. Taking into account that ActionScript and Alchemy output runs on the same AVM2 and that abstraction level of the AVM2 bytecode is a lot higher than the the LLVM bytecode, it would mean that all operations which are done in C/C++ must be wrapped with mechanisms which are available in AVM2. In such situation using Alchemy would be slower than ActionScript since it is always better to fine-tune ActionScript code than let it be done by Alchemy where it is not known exactly how things are translated from C/C++ to AVM2 bytecode. Alchemy achieves considerably better performance than ActionScript 3.0 thanks to special opcodes which were introduced in FlashPlayer10. These Opcodes are not accessible form standard ActionScript 3.0 because they provide access to a new memory that is completely segregated from the memory used for ActionScript objects. The new opcodes help implement the C memory model, an untyped linear array of bytes. Programs using this model are faster than programs using the memory model of ActionScript 3.0, a collection of interlinked, typed objects. Besides that for operations involving ByteArrays there are opcodes that are optimised for performance, which the ASC (ActionScript Compiler) does not generate today. Other advantage for the Alchemy is that it uses LLVM to optimize the code it generates what results in bytecode that is often better than the one produced by ASC. It is possible because LLVM C compiler performs many code optimizations that the ASC does not do yet. First stable version of the Alchemy was introduced at Adobe Max Conference 2008 and was released on 10th December 2008. Before that it was known under codename FlaCC. Since that time it was successfully used in various projects: polygon triangulation library [22], 3D engine Alternativa3D [23], PDF generator PurePDF [24] or JPEG encoder [25] which made possible to encode bitmaps 20 times faster than in case of standard ActionSctipt library [26]. Benefits in performance area achieved in those projects made Alchemy worth taking a closer look. Figure 6. ActionScript + Alchemy FFT calculations times. Using more than 131072 samples caused Alchemy to randomly throw errors connected with memory management. Alchemy is still a beta product and some underdevelopments should be expected. ActionScript with C/C++ application ActionScript does not provide any support for communication with C applications therefore some third party had to be used. Three sub-scenarios were tested: two of them involve AMF protocol and the last one relied on FileReference class [27] (Figure 7). According to data loading comparison for Rich Internet Applications technologies created by James Ward AMF protocol offers the best performance [28]. AMF is a binary format used to serialize ActionScript objects and send them between Flash client and a remote service. Two implementations of AMF protocol were tested: AMFPHP [29] and Zend AMF-PHP [30]. Figure 7. ActionScript - C communication methods. Zend AMF Zend version of AMF-PHP is officially supported by Adobe, it offers various complex functionalities as it is a part of Zend framework, an application framework for PHP and it has a group of experienced developers behind it. Figure 8. ActionScript + C (Zend AMF) FFT calculations times. Using more than 65532 samples caused Zend AMF to have problems with sending results back to Flex application. AMF AMF-PHP is a one-man project developed since 2003. It has focused our attention because it is claimed in the Flash community that it can be significantly faster than Zend AMF. Figure 9. ActionScript + C (AMF) FFT calculations times. Using more than 131072 samples caused AMF to have problems with sending results back to Flex application. FileReference Class In above AMF scenarios input data was send to PHP script which saved it to a binary file and than executed C application which read the file, did all computations and saved results to a output binary file. Next PHP read the output file and sent obtained data back to Flex application (Figure 10). Figure 10. ActionScript - C (AMF) pipeline. Taking into account that AMF is used to serialize ActionScript objects then if no complex objects but simple array of data is exchanged between Flex and C AMF can be removed from the communication pipeline without any consequences. In such sub-scenario bytes array is saved to a file from Flex, Flex runs PHP script which only executes C application after what Flex downloads C output file and parses it's content (Figure 11). Figure 11. ActionScript - C (FileReference) pipeline. Unlike both C (AMF) communications methods FileReference was reliable for all of provided input data sets. Figure 12. ActionScript + C (FileReference) FFT calculations times. It it interesting that in the most of the performed tests FileReference scenario resulted with similar times. After doing a more detailed time measures it was found out that most of the time used by this method is consumed for C calculations and downloading and parsing output data. For the last two input datasets time consumed by C application (includes execution from PHP script and time registration) exceeds time used for downloading and parsing output data (C to AS). Tabela 1. ActionScript - C (FileReference) detailed times in ms. Step/ samples AS to C C C to AS Total time 1024 5,79 147,08 403,2 556,07 2048 21,82 200,24 318,49 540,55 4096 5,28 188,97 344,35 538,6 8192 4,22 189,53 266,46 460,2 16384 6,39 201,27 367,51 575,17 32768 4,99 213,13 366,85 584,98 65532 6,28 289,07 300,63 595,98 131072 5,46 420,22 237,01 662,69 262144 6,52 670,39 553,4 524288 5,62 1219,44 857,47 1230,31 2082,53 Pure C application In addition, to have a complete "picture" C application without any wrapping scripts was tested. In general it is 2-3 times faster then Alchemy and C with FileReference method (Figure 13). Figure 13. C FFT calculations times. Benchmarks summary All the performed benchmarks considered time from passing input data to receiving useful output data in a form of array. Some of tested methods returned ByteArray which is a raw block of data that needs to be interpreted before it can be used any further. To treat all methods equally measuring computation time was stopped after achieving output data in form of ActionScript Array. Besides that each computation method was ran 100 times for each input data set and arithmetic mean was calculated to obtain resulting time. In order to avoid any influence from previous calculations all executions were separated with 1000 ms period of time. All tests presented in this paper were performed on Intel Core2Duo 2.66MHz machine with 2GB DDR2 800MHz RAM memory. Figure 14. Number of samples - time dependency for various computation methods. Conclusions The best performance for Flex web application was achieved with Alchemy project and C application with FileReference communication. Results in this cases were 2-3 times worse then in case of pure C application. ActionScript, as expected, had one of the longest computations times. Both AMF methods turned out to be the biggest disappointment because their times were significantly higher even than ActionScript times. It is visible especially in Zend AMF benchmarks. On the other hand it does not mean that the AMF methods are completely useless. They provide data type mapping mechanisms which are for sure very convenient in business logic where complex objects are exchanged between database and user interface. Alchemy and FileReference methods are not completely comparable since one is run on a local machine while the other on a remote machine. Regardles to that two important observations were made: Alchemy (in opposition to ActionScript) provides a way to greatly improve performance in flash-based applications, the most reasonable approach to build flash-based web applications, that perform complex computations, is to use C program running on a server-side and communicate with it by FileReference method. While both AMF and Alchemy approaches failed when big enough data was transferred FileReference worked well for all data packages. Besides that using server-side program hardware and software can be controlled and adjusted properly to achieve satisfying efficiency. Bibliography 1. Tadeusiewicz R. (2009) Theoretical Neurocybernetics. Warsaw University Publishers. 2. Tadeusiewicz R. (2009) Models of the nervous system elements as artificial neural networks. Chapter in Book "Theoretical Neurocybernetics". Warsaw University Publishers, 109-127. 3. Tadeusiewicz R. (2010) New trends in neurocybernetics. Computer Methods in Materials Science, 1(10):1-7. 4. Tadeusiewicz R. (1994) Problems of Biocybernetics. Polish Scientific Publishers (PWN), Warsaw. 5. Tadeusiewicz R. (2011) Informatyka i psychologia w spoleczestwie informacyjnym, ch. Neural Networks as Computational Tool with Interesting Psychological Applications [In Polish: Sieci neuronowe i inne systemy neurocybernetyczne jako narzdzia informatyczne o ciekawych zastosowaniach na gruncie psychologii]. AGH Publishers, 49-101, Kraków. 6. Tadeusiewicz R. (2010) ch. Modelling of the neural system elements with the neural networks use. On the paths of Neuroscience by Piotr Fracuz (ed.), KUL Publishers, 13-34. 7. Tadeusiewicz R. (2010) Computers in psychology and psychology in computer science, in Proceedings of the 2010 International Conference on Computer Information Systems and Industrial Management Applications (CISIM) With Applications to Ambient Intelligence and Ubiquitous Systems (V.S.e. Abraham A, Saeed K, ed.), IEEE, 34-38. 8. Wierzgala P, Wójcik GM. (2010) Signal visualisation software for Mindset MS1000 electroencephalograph. Bio-Algoritms and Med-Systems 1(13):83-87. 9. Online mockup builder: builds.balsamiq.com/b/mockups-web-demo/ (June, 2012) 10. Online UML diagrams creator: www.yuml.me (June, 2012) 11. Online media converter: www.media.io (June, 2012) 12. Adobe labs: labs.adobe.com/technologies/alchemy (June, 2012) 13. Mikolajewska E, Mikolajewski D. (2011) Interfejsy mózg-komputer ­ zastosowania cywilne i wojskowe. Kwartalnik Bellona, 2:123-133 (in Polish). 14. Mikolajewska E, Mikolajewski D. (2011) Neurorehabilitacja XXI wieku. Techniki teleinformatyczne. Impuls, 71-84, Kraków (in Polish). 15. Krusienski DJ, Grosse-Wentrup M, Galán F, Coyle D, Miller KJ, Forney E. et al. (2011) Critical issues in state-of-the-art brain-computer interface signal processing. J Neural Eng, 8(2). 16. Mikolajewski D, Mikolajewska E. (2011) Exoskeletons in neurological diseases - current and potential future applications. Adv Clin Exp Med, 20(2), 227-233. 17. Zanter TO, Kothe Ch. (2011) Towards passive brain-computer interfaces: applying brain-computer interface technology to human-machine systems in general. J Neural Eng, 8(2). 18. Neuroinformatic System for Science, Industry and Education: nessie.umcs.lublin.pl/EEG (June, 2012) 19. ActionScript Technology Center: adobe.com/devnet/actionscript.html (June, 2012) 20. The LLVM Compiler infrastructure: llvm.org (June, 2012) 21. Nicolas Cannasse weblog: www.ncannasse.fr/blog/adobe_alchemy (June, 2012) 22. Adobe Alchemy libraries: labs.adobe.com/wiki/index.php/Alchemy:Libraries:Shared (June, 2012) 23. Alternativa3D library: alternativaplatform.com/en/alternativa3d/ (June, 2012) 24. Pure PDF library: http://code.google.com/p/purepdf/ (June, 2012) 25. Alchemy JPEG encoder: segfaultlabs.com/devlogs/alchemy-asynchronous-jpegencoding (June, 2012) 26. Alchemy JPEG encoder performance tests: websector.de/blog/2009/06/21/speed-up-jpeg-encoding-using-alchemy/ (June, 2012) 27. FileReference: help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/ FileReference.html (June, 2012) 28. Flex protocols comparison: http://www.jamesward.com/census2/ (June, 2012) 29. AMF PHP: http://amfphp.sourceforge.net/ (June, 2012) 30. Zend AMF: http://framework.zend.com/manual/en/zend.amf.introduction.html (June, 2012)

Journal

Bio-Algorithms and Med-Systemsde Gruyter

Published: Dec 1, 2012

There are no references for this article.