• I need to run the program in very fast speed,...

    @user101931, you have to be a bit more specific about

    the program

    More specific in sense of structure... For example, you have to serve an even very fast: react very quickly - with out delay - and calculate/compose a result very quickly. The next question is: do you want to take advantage of Espruino as a system and how easy it is to use? Speeding up an application is not a linear street: for some things there is no speed up, such as serially communicated. Going fully 'raw - C native - you may squeeze out a lot of power from an algorithm, but communicating the result takes a while and the overhead caused by the simplicity of use / application is only a few %.

    What @Gordon means w/

    it's always possible that the JS surrounding your inline C is slowing it down).

    is the switching between environments - JavaScript calling native/raw/inline C - and then go back out and in again. In JavaScript references are base on lookup where as on incline C / raw, native, references are resolved upfront. In JavaScript memory is dynamically managed by the (Espruino) system where as on incline C / raw, native, memory is application managed. Since JS is dynamic and passes the addresses in calls to (inline) C and they can change between invocations. So make your pick. Enhancing the garbage collected memory mechanism w/ areas to lock down (and allocation at the 'beginning' to not fragment the remaining memory can help curb dynamics. Memory handling and garbage collect is though Espruino specific and different to other implementations as used on other general purpose computer platforms.

    With a smart setup / combination of Espruino (JS) firmware combined w/ raw, native C programming - inline or as firmware extensions w/ own build - you can co really do great.

About

Avatar for allObjects @allObjects started