An Introduction to JS-Ctypes

Brendan Eich brendan at mozilla.com
Sat Sep 17 11:43:50 PDT 2011


On Sep 17, 2011, at 2:34 PM, Andrea Giammarchi wrote:

> Also I have explicitly slowed down the logic creating a "classic" literal JS object per each loop iteration ... still, way too slow performances so whatever js-ctypes has been created for, something went wrong, imo

Why are you doing that? I mean this, from your ctypes.perf.html:

    for (var t = new Date, i = 0, length = npoints.length; i < length; i += 2) {
        window.lastPoint = {x: npoints[i], y: npoints[i + 1]};
    }

Don't make an object per loop iteration, instead assign to .x and .y separately.

Anyway, the ctypes performance bug you're reporting does not predict binary data perf. Ctypes as a privileged FFI for SpiderMonkey, based on Python ctypes, was just brought up recently (in the life of SpiderMonkey). The JITs do not optimize for it as they do for typed arrays. Please file it at bugzilla.mozilla.org with your testcase. Thanks,

/be



More information about the es-discuss mailing list