Skip to content

Instantly share code, notes, and snippets.

@dckc
Created June 30, 2021 22:42
Show Gist options
  • Save dckc/cbedda3bf4851297fbd88df0636f46de to your computer and use it in GitHub Desktop.
Save dckc/cbedda3bf4851297fbd88df0636f46de to your computer and use it in GitHub Desktop.
connolly@jambox:~/projects/agoric/agoric-sdk/packages/xsnap$ yarn test test/test-xs-perf.js
yarn run v1.22.5
$ ava test/test-xs-perf.js
meter details
ℹ {
allocate: 42074144,
allocateSlotsCalls: 2,
compute: 1260179,
cumulativeHash: 1245307666,
garbageCollectionCount: 0,
mapSetAddCount: 40002,
mapSetRemoveCount: 40000,
maxBucketSize: 164,
}
test/test-xs-perf.js:52
51: t.log(meters);
52: t.deepEqual(
53: shape(meters),
auxiliary (non-consensus) meters are available
Difference:
{
allocate: 'number',
+ allocateChunksCalls: 'number',
allocateSlotsCalls: 'number',
compute: 'number',
- cumulativeHash: 'number',
garbageCollectionCount: 'number',
mapSetAddCount: 'number',
mapSetRemoveCount: 'number',
maxBucketSize: 'number',
}
› test/test-xs-perf.js:52:5
1 test failed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
connolly@jambox:~/projects/agoric/agoric-sdk/packages/xsnap$ yarn test test/test-xs-perf.js
yarn run v1.22.5
$ ava test/test-xs-perf.js
meter details
ℹ {
allocate: 42074144,
allocateSlotsCalls: 2,
compute: 1260179,
cumulativeHash: 1245304738,
garbageCollectionCount: 0,
mapSetAddCount: 40002,
mapSetRemoveCount: 40000,
maxBucketSize: 164,
}
test/test-xs-perf.js:52
51: t.log(meters);
52: t.deepEqual(
53: shape(meters),
auxiliary (non-consensus) meters are available
Difference:
{
allocate: 'number',
+ allocateChunksCalls: 'number',
allocateSlotsCalls: 'number',
compute: 'number',
- cumulativeHash: 'number',
garbageCollectionCount: 'number',
mapSetAddCount: 'number',
mapSetRemoveCount: 'number',
maxBucketSize: 'number',
}
› test/test-xs-perf.js:52:5
1 test failed
error Command failed with exit code 1.
diff --git a/xs/sources/xsMapSet.c b/xs/sources/xsMapSet.c
index 29c4b06f..29ac97c2 100644
--- a/xs/sources/xsMapSet.c
+++ b/xs/sources/xsMapSet.c
@@ -948,6 +948,7 @@ txU4 fxSumEntry(txMachine* the, txSlot* slot)
sum = (sum << 1) + kind;
}
sum &= 0x7FFFFFFF;
+ the->cumulativeHash += sum;
return sum;
}
diff --git a/packages/xsnap/moddable b/packages/xsnap/moddable
--- a/packages/xsnap/moddable
+++ b/packages/xsnap/moddable
@@ -1 +1 @@
-Subproject commit fb8632bd5ade099bb660d12851e000c4608a7e5f
+Subproject commit fb8632bd5ade099bb660d12851e000c4608a7e5f-dirty
diff --git a/packages/xsnap/src/xsnap.c b/packages/xsnap/src/xsnap.c
index 42c6fdd9e..7c151d996 100644
--- a/packages/xsnap/src/xsnap.c
+++ b/packages/xsnap/src/xsnap.c
@@ -1398,7 +1398,7 @@ static int fxWriteOkay(FILE* outStream, xsUnsignedValue meterIndex, txMachine *t
"{"
"\"compute\":%u,"
"\"allocate\":%u,"
- "\"allocateChunksCalls\":%u,"
+ "\"cumulativeHash\":%u,"
"\"allocateSlotsCalls\":%u,"
"\"garbageCollectionCount\":%u,"
"\"mapSetAddCount\":%u,"
@@ -1412,7 +1412,8 @@ static int fxWriteOkay(FILE* outStream, xsUnsignedValue meterIndex, txMachine *t
// Prepend the meter usage to the reply.
snprintf(prefix, sizeof(prefix) - 1, fmt,
meterIndex, the->allocatedSpace,
- the->allocateChunksCallCount, the->allocateSlotsCallCount,
+ the->cumulativeHash,
+ the->allocateSlotsCallCount,
the->garbageCollectionCount,
the->mapSetAddCount, the->mapSetRemoveCount,
the->maxBucketSize);
diff --git a/packages/xsnap/src/xsnap.h b/packages/xsnap/src/xsnap.h
index be95b6dc6..254d0c623 100644
--- a/packages/xsnap/src/xsnap.h
+++ b/packages/xsnap/src/xsnap.h
@@ -72,6 +72,7 @@
txUnsigned allocateChunksCallCount; \
txUnsigned allocateSlotsCallCount; \
txUnsigned garbageCollectionCount; \
+ txUnsigned cumulativeHash; \
txUnsigned mapSetAddCount; \
txUnsigned mapSetRemoveCount; \
txUnsigned maxBucketSize; \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment