ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge
wyrichte on ADO_test
Update ChakraCoreStatic.cpp (compare)
wyrichte on Test-PR-webhook---don't-merge
Update ChakraCoreStatic.cpp (compare)
wyrichte on Test-PR-webhook---don't-merge
Update ChakraCoreStatic.cpp (compare)
Basically if I have a query that looks like
from(array).where(n => n % 2 === 0).select(n => n * 8).reduce((a, n) => a + n, 0);
that gets "jitted" to a function which is called to actually run the query
((array, filter0, map1, reducer, acc) => {
for (let i = 0, len = array.length; i < len; ++i) {
value = array[i];
if (!filter0(value)) continue;
value = map1(value);
acc = reducer(acc, value);
}
return acc;
})
require
it in, it's fast. Passing the same exact source code to new Function
is slower by a factor of 3-4
Following up on the query compiler system I discussed above, I've implemented it and now my built-in from()
beats everyone else's functional libraries by a comfortable margin :smile:
const arr = /* 100K random floats between 0-1000 */;
from(arr)
.where(n => n < 500)
.take(100)
.select(n => Math.floor(n))
.plus("rando string")
.shuffle()
.count(it => typeof it);
Benchmarking results:
event count time (us) % run avg (us) % avg |
--------------------------------------------------------------------
Underscore _.chain() 1,001 2,398,028 93.7 % 2,395 95.3 % |
Lodash _.chain() 1,001 43,649 1.7 % 43 1.7 % |
from.js 1.0 1,001 38,226 1.5 % 38 1.5 % |
Lazy.js Lazy() 1,001 21,433 0.8 % 21 0.9 % |
from() (mS 5.3+) 1,001 15,326 0.6 % 15 0.6 % |
references
of your projects?
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Allegro" version="5.2.4.0" targetFramework="native" />
<package id="AllegroDeps" version="1.7.0.0" targetFramework="native" />
<package id="Microsoft.ChakraCore.vc140" version="1.11.3" targetFramework="native" developmentDependency="true" />
</packages>
.sln
+ all .*proj
files in the same directory and MSVC generally seems to prefer one .vcxproj per directory
But I do have a different question. I know ChakraCore will preserve any JsValueRefs that exist on the stack, but I was wondering if this particular case will be safe:
JsValueRef makeobj() {
JsValueRef ref;
ref = JsCreateObject(...);
return ref;
}
void do_stuff() {
JsValueRef objRef = makeobj();
/* ... */
}
See, the GC runs off-thread and technically in the above code there may be a small window where the reference doesn't exist on the stack because the stack frame it was created in has been torn down but it also hasn't yet been assigned to the stack variable in the caller. For a short time it only exists in a register, e.g. EAX. Will the GC preserve objects whose only live reference is currently stored in a register?