Skip to content

Caching of compiled C# code

Compare
Choose a tag to compare
@tjanczuk tjanczuk released this 21 Sep 14:12
· 334 commits to master since this release

The 0.9.3 release of Edge.js adds support for caching of C# compilation results, thus increasing the performance of repetitive calls to edge.func with the same C# code.

This feature is opt-in and enabled by setting the EDGE_CS_CACHE=1 environment variable.

When is it useful

Whenever you are calling edge.func with the same C# literal several times in the lifetime of a node process, caching will enable you to greatly improve performance. For example:

require('http').createServer(function (req, res) {
    var f = require('edge').func('async (i) => { return "Hello"; }');
    f(null, function (error, result) {
        if (error) throw error;
        res.send(result);
    });
}).listen(8080);