-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(xsnap)!: avoid O(n^2) Array, Map, Set growth #3560
Conversation
080c0d8
to
b93a534
Compare
Moddable commit ff1bfaf04249 rendered mxMapEntriesIteratorPrototype obsolete in favor of mxMapIteratorPrototype and likewise several others. style: use standard return type for main() to avoid a warning that may distract from security review
XS implementation now has conventional O(n log(n)) algorithm. - xs-meter-9 represents XS Map/Set optimizations - style: update indentaion in test-xs-perf.js fixes #3012
For release management, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat, thanks.
mxFreezeBuiltInCall; mxPush(mxMapKeysIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxMapValuesIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxMapIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxModulePrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxRegExpStringIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxSetEntriesIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxSetKeysIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxSetValuesIteratorPrototype); mxFreezeBuiltInRun; | ||
mxFreezeBuiltInCall; mxPush(mxSetIteratorPrototype); mxFreezeBuiltInRun; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Story checks out:
$ node
> new Map().keys().__proto__ === new Map().entries().__proto__
true
@@ -138,7 +139,9 @@ test('metering can be switched off / on at run-time', async t => { | |||
const opts = options(io); | |||
const vat = xsnap(opts); | |||
t.teardown(() => vat.terminate()); | |||
const { meterUsage: { compute: noUnMeteredCompute } } = await vat.evaluate(` | |||
const { | |||
meterUsage: { compute: noUnMeteredCompute }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Maybe fullyMeteredCompute
to cancel the negatives. I want to love giving Un
its own camel hump, and also MoDem
, TeleType
, and TransCoder
.
t.true(r2.rate / r1.rate >= 1); | ||
t.true(r3.rate / r2.rate >= 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these assertions verify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that the data structure manipulation rate (computed above as n * logn / delta_t
) stays comparable as the (binary) order of magnitude grows.
It used to be >= 0.85
. Now that it's >= 1
, it could just be r2.rate >= r1.rate
, I suppose.
TODO:
BREAKING CHANGE: xs-meter-9 represents XS Map/Set optimizations
see also https://github.com/agoric-labs/moddable/tree/ag-testnet-5 ; this time, I merged Moddable's
public
branch into our "vendor branch" rather than rebasing.commit 4372617 is work that we would have gotten for free if we had integrated Moddable's refactor of
xsnap.c
into platform and application. endojs/endo#681fixes #3012