Skip to content

Commit

Permalink
test: more timestamp offset for bigInt UT
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Oct 19, 2023
1 parent 20e32bd commit f1f20a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/unit/config/lwwMapTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { expect, config } from 'chai';
import { LWWMap, LWWState, SYMBOL_FOR_DELETED } from '../../../src/config/lwwMap';

config.truncateThreshold = 0;
const OLD_TIMESTAMP_OFFSET = BigInt(10_000_000_000_000);

describe('LWWMap', () => {
type TestType = { foo: string; baz: string; opt?: number; optNull?: null };
describe('all properties are known', () => {
Expand Down Expand Up @@ -93,8 +95,8 @@ describe('LWWMap', () => {
});
it('none are updated', () => {
const remoteState = {
foo: { value: 'bar2', timestamp: process.hrtime.bigint() - BigInt(10000000000) },
baz: { value: 'qux2', timestamp: process.hrtime.bigint() - BigInt(10000000000) },
foo: { value: 'bar2', timestamp: process.hrtime.bigint() - OLD_TIMESTAMP_OFFSET },
baz: { value: 'qux2', timestamp: process.hrtime.bigint() - OLD_TIMESTAMP_OFFSET },
} satisfies LWWState<TestType>;
lwwMap.merge(remoteState);
expect(lwwMap.state).to.deep.equal(state);
Expand All @@ -104,7 +106,7 @@ describe('LWWMap', () => {
lwwMap.set('opt', 4);
const remoteState = {
foo: { value: 'bar2', timestamp: process.hrtime.bigint() },
baz: { value: 'qux2', timestamp: process.hrtime.bigint() - BigInt(10000000000) },
baz: { value: 'qux2', timestamp: process.hrtime.bigint() - OLD_TIMESTAMP_OFFSET },
opt: { value: SYMBOL_FOR_DELETED, timestamp: process.hrtime.bigint() },
optNull: { value: null, timestamp: process.hrtime.bigint() },
} satisfies LWWState<TestType>;
Expand Down

4 comments on commit f1f20a6

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - ubuntu-latest

Benchmark suite Current: f1f20a6 Previous: 20e32bd Ratio
Child logger creation 499026 ops/sec (±1.37%) 528442 ops/sec (±0.84%) 1.06
Logging a string on root logger 646407 ops/sec (±8.13%) 656967 ops/sec (±10.74%) 1.02
Logging an object on root logger 350076 ops/sec (±16.11%) 381956 ops/sec (±15.61%) 1.09
Logging an object with a message on root logger 202793 ops/sec (±16.95%) 275824 ops/sec (±13.93%) 1.36
Logging an object with a redacted prop on root logger 231853 ops/sec (±18.69%) 7382 ops/sec (±202.18%) 0.03183913945474072
Logging a nested 3-level object on root logger 7661 ops/sec (±187.53%) 259135 ops/sec (±9.87%) 33.83

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Logger Benchmarks - ubuntu-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: f1f20a6 Previous: 20e32bd Ratio
Logging a nested 3-level object on root logger 7661 ops/sec (±187.53%) 259135 ops/sec (±9.87%) 33.83

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger Benchmarks - windows-latest

Benchmark suite Current: f1f20a6 Previous: 20e32bd Ratio
Child logger creation 211194 ops/sec (±113.76%) 416499 ops/sec (±7.93%) 1.97
Logging a string on root logger 613401 ops/sec (±11.43%) 493560 ops/sec (±17.00%) 0.80
Logging an object on root logger 347661 ops/sec (±26.61%) 291106 ops/sec (±17.75%) 0.84
Logging an object with a message on root logger 261759 ops/sec (±16.12%) 192025 ops/sec (±20.20%) 0.73
Logging an object with a redacted prop on root logger 270645 ops/sec (±22.51%) 183525 ops/sec (±19.77%) 0.68
Logging a nested 3-level object on root logger 983 ops/sec (±276.76%) 117917 ops/sec (±21.92%) 119.96

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Logger Benchmarks - windows-latest'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: f1f20a6 Previous: 20e32bd Ratio
Logging a nested 3-level object on root logger 983 ops/sec (±276.76%) 117917 ops/sec (±21.92%) 119.96

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.