Основная цель проекта - предоставить возможность писать на JavaScript-а эффективный код не страдающий от пауз GC. Код на LLJS преобразуется в обычный JS. Думаю, если реализовать поддержку непосредственно в движке JS (как планирует Google поступить с Dart), может получиться весьма занимательная в плане производительности штука.
Пример:
extern timer; // Declare timer as an external variable.
let x; // Declare 'x' as dyn.
let int y; // Declare 'y' as int.
y = (int)(x); // Assignment of 'x' to 'y' requires an explicit
// cast.
let int z = y + 1; // Although 'y' is of type int, the binary
// expression y + 1 is of type num and
// requires an implicit cast.
let uint w = z; // Unsigned integer types are supported but
// are discouraged because JavaScript engines
// usually store numbers that are larger than
// max signed int in doubles rather than 32-bit
// ints.
timer.begin("Empty For loop with signed integers.");
for (let int i = 0; i < 50000000; ++i) { }
timer.begin("Empty For loop with unsigned integers.");
for (let uint i = 0; i < 50000000; ++i) { }
timer.begin("Empty For loop with untyped integers.");
for (let i = 0; i < 50000000; ++i) { }
http://mbebenita.github.com/LLJS/

Комментариев нет:
Отправить комментарий