Matthias Grimmer, Thomas Würthinger, Andreas Wöß, Hanspeter Mössenböck,
"An efficient approach for accessing C data structures from JavaScript"
: ICOOOLPS '14 Proceedings of the 9th International Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems PLE, ACM New York, 7-2014, ISBN: 978-1-4503-2914-9
Original Titel:
An efficient approach for accessing C data structures from JavaScript
Sprache des Titels:
Englisch
Original Buchtitel:
ICOOOLPS '14 Proceedings of the 9th International Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems PLE
Original Kurzfassung:
We present a novel approach for allowing JavaScript applications to access C data structures without performance overhead or additional boiler plate code.
Dynamic languages such as JavaScript do not have a fixed memory layout for run-time data nor do they allow low-level memory accesses, which makes interoperability with languages such as C hard.
Our approach allows JavaScript applications to transparently use C pointers as receivers of object accesses or array accesses, thus the programmer can access C data structures as if they were JavaScript objects. We describe how we modified an existing JavaScript interpreter so that it generates different access operations at run time depending on whether the receiver is a JavaScript object or a C pointer. We evaluated our prototype using benchmarks that measure array access performance. The evaluation of our JavaScript interpreter shows that using C arrays from within JavaScript is on average 27% faster than using regular JavaScript arrays and 19% faster than using Typed Arrays.