Skip to content
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

enhance: schema.Entity -> EntityMixin #3243

Merged
merged 1 commit into from
Oct 13, 2024
Merged

enhance: schema.Entity -> EntityMixin #3243

merged 1 commit into from
Oct 13, 2024

Conversation

ntucker
Copy link
Collaborator

@ntucker ntucker commented Oct 12, 2024

Motivation

Clearer naming

Solution

schema.Entity -> EntityMixin

import { EntityMixin } from '@data-client/rest';

export class Article {
  id = '';
  title = '';
  content = '';
  tags: string[] = [];
}

export class ArticleEntity extends EntityMixin(Article) {}

We keep schema.Entity for legacy, and add schema.EntityMixin and EntityMixin as direct export

Copy link

changeset-bot bot commented Oct 12, 2024

🦋 Changeset detected

Latest commit: 7413225

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@data-client/normalizr Patch
@data-client/endpoint Patch
@data-client/graphql Patch
@data-client/rest Patch
example-benchmark Patch
normalizr-github-example Patch
normalizr-redux-example Patch
normalizr-relationships Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ntucker ntucker force-pushed the EntityMixin branch 2 times, most recently from ae8b080 to c3a2e89 Compare October 12, 2024 16:46
Copy link

codecov bot commented Oct 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.94%. Comparing base (f81737c) to head (b9e8de4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3243   +/-   ##
=======================================
  Coverage   98.94%   98.94%           
=======================================
  Files         132      132           
  Lines        2269     2270    +1     
  Branches      467      467           
=======================================
+ Hits         2245     2246    +1     
  Misses         13       13           
  Partials       11       11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 7413225 Previous: f81737c Ratio
normalizeLong 519 ops/sec (±0.26%) 507 ops/sec (±0.30%) 0.98
infer All 9424 ops/sec (±0.45%) 9577 ops/sec (±0.56%) 1.02
denormalizeLong 346 ops/sec (±0.75%) 346 ops/sec (±0.74%) 1
denormalizeLong donotcache 885 ops/sec (±1.20%) 882 ops/sec (±2.15%) 1.00
denormalizeShort donotcache 500x 1342 ops/sec (±1.15%) 1374 ops/sec (±0.19%) 1.02
denormalizeShort 500x 985 ops/sec (±0.38%) 972 ops/sec (±0.31%) 0.99
denormalizeShort 500x withCache 4820 ops/sec (±0.16%) 4795 ops/sec (±0.20%) 0.99
denormalizeLong with mixin Entity 302 ops/sec (±0.40%) 300 ops/sec (±0.38%) 0.99
denormalizeLong withCache 6701 ops/sec (±0.58%) 6201 ops/sec (±0.17%) 0.93
denormalizeLong All withCache 6527 ops/sec (±0.16%) 6394 ops/sec (±0.76%) 0.98
denormalizeLong Query-sorted withCache 6480 ops/sec (±0.22%) 6292 ops/sec (±0.52%) 0.97
denormalizeLongAndShort withEntityCacheOnly 1496 ops/sec (±0.56%) 1505 ops/sec (±0.72%) 1.01
getResponse 6079 ops/sec (±1.18%) 5941 ops/sec (±1.21%) 0.98
getResponse (null) 5285931 ops/sec (±0.42%) 5273056 ops/sec (±0.80%) 1.00
getResponse (clear cache) 291 ops/sec (±0.46%) 297 ops/sec (±0.44%) 1.02
getSmallResponse 2643 ops/sec (±0.20%) 2692 ops/sec (±0.28%) 1.02
getSmallInferredResponse 2040 ops/sec (±0.59%) 2071 ops/sec (±0.27%) 1.02
getResponse Query-sorted 6809 ops/sec (±0.37%) 6638 ops/sec (±0.76%) 0.97
getResponse Collection 5913 ops/sec (±0.64%) 6231 ops/sec (±1.56%) 1.05
get Collection 4950 ops/sec (±1.21%) 5406 ops/sec (±1.13%) 1.09
setLong 515 ops/sec (±0.59%) 504 ops/sec (±0.41%) 0.98
setLongWithMerge 204 ops/sec (±0.32%) 203 ops/sec (±0.31%) 1.00
setLongWithSimpleMerge 216 ops/sec (±0.34%) 212 ops/sec (±0.43%) 0.98
setSmallResponse 500x 901 ops/sec (±0.30%) 910 ops/sec (±0.20%) 1.01

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

@ntucker ntucker force-pushed the EntityMixin branch 2 times, most recently from 7b2d8b8 to 2367f3d Compare October 13, 2024 07:36
@ntucker ntucker marked this pull request as ready for review October 13, 2024 07:54
@ntucker ntucker force-pushed the EntityMixin branch 2 times, most recently from b9e8de4 to 009e759 Compare October 13, 2024 09:32
@ntucker ntucker changed the title enhance: EntityMixin enhance: schema.Entity -> EntityMixin Oct 13, 2024
@ntucker ntucker merged commit 43a955c into master Oct 13, 2024
4 of 5 checks passed
@ntucker ntucker deleted the EntityMixin branch October 13, 2024 09:35
@github-actions github-actions bot mentioned this pull request Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant