Quote:
Originally Posted by Arhowk
O.O
How exactly are you doing this...? Assuming you're just throwing the talons inside of a SimpleBinding, 5 seconds is absolutely monstrous. Are you doing something wierd like interfacing with the HAL layer directly from JavaScript?
|
Not at all actually, we were passing the Talon, Solenoid, and other classes directly to the scripts as variables, and the scripts simply called their methods (i.e. Talon.set(n)

. The problem is with the amount of scripts / the length of scripts. If your program had just a single script that said
, it would execute fine (but is entirely useless). The more scripts and the longer the scripts are, the longer it took for the interpreter to parse them, and call their methods, thus the 5 second execution time.
We're switching to v8 because it utilizes JIT compilation. We are using the roboRIO's file system to store scripts, and the program compiles them at startup (during queue, for example), and never touches them again, unless our development mode is active. In this case, an external file watcher on the development machine watches for changes to javascript files, and when it detects one, sends the changes to the roboRIO, which stores the new file on the File System, and recompiles it. This minimizes execution time to instantaneous during competition (as no compilation is done during a match because no development is active), and much shorter times than the current java/c++ compilation times for WPI/eclipse.