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

refactor: re-implement map type #26

Merged
merged 1 commit into from
Sep 16, 2023
Merged

refactor: re-implement map type #26

merged 1 commit into from
Sep 16, 2023

Conversation

forehalo
Copy link
Collaborator

@forehalo forehalo commented Sep 15, 2023

#20

  • remove Arc<Content> on item
  • make map iteration lazy
  • standardize map user-seeing in/out type

@forehalo forehalo added enhancement New feature or request refactory labels Sep 15, 2023
@forehalo forehalo self-assigned this Sep 15, 2023
@forehalo forehalo mentioned this pull request Sep 15, 2023
7 tasks
@forehalo forehalo temporarily deployed to development September 15, 2023 09:33 — with GitHub Actions Inactive
darkskygit
darkskygit previously approved these changes Sep 15, 2023
y-octo/src/doc/codec/item.rs Outdated Show resolved Hide resolved
@forehalo forehalo temporarily deployed to development September 15, 2023 09:54 — with GitHub Actions Inactive
@github-actions
Copy link

Benchmark for Linux

Click to view benchmark
Test Base PR %
codec/jwst decode var_int (32 bit) 449.1±22.12µs 439.1±20.83µs -2.23%
codec/jwst decode var_uint (32 bit) 385.2±12.86µs 385.0±13.32µs -0.05%
codec/jwst decode var_uint (64 bit) 426.3±17.38µs 422.1±12.30µs -0.99%
codec/jwst encode var_int (32 bit) 566.8±31.08µs 561.2±14.37µs -0.99%
codec/jwst encode var_uint (32 bit) 343.9±11.82µs 346.7±16.43µs +0.81%
codec/jwst encode var_uint (64 bit) 343.4±11.07µs 347.8±16.70µs +1.28%
codec/lib0 decode var_int (64 bit) 361.7±17.87µs 353.7±9.05µs -2.21%
codec/lib0 decode var_uint (32 bit) 309.7±14.33µs 305.1±9.80µs -1.49%
codec/lib0 decode var_uint (64 bit) 308.8±12.72µs 309.3±10.92µs +0.16%
codec/lib0 encode var_int (64 bit) 518.7±21.15µs 515.0±13.45µs -0.71%
codec/lib0 encode var_uint (32 bit) 345.2±16.48µs 347.9±14.78µs +0.78%
codec/lib0 encode var_uint (64 bit) 347.6±13.42µs 349.3±16.64µs +0.49%
ops/array/jwst/insert 327.2±10.97µs 307.4±7.13µs -6.05%
ops/array/jwst/insert range 495.6±15.87µs 452.7±12.81µs -8.66%
ops/array/jwst/remove 204.5±9.64µs 192.2±3.99µs -6.01%
ops/array/yrs/insert 105.2±3.18µs 105.3±2.46µs +0.10%
ops/array/yrs/insert range 137.2±4.31µs 137.6±4.28µs +0.29%
ops/array/yrs/remove 126.0±3.42µs 122.0±4.17µs -3.17%
ops/text/jwst/insert 186.4±16.18µs 161.2±3.83µs -13.52%
ops/text/jwst/remove 4.3±0.14µs 4.0±0.10µs -6.98%
ops/text/yrs/insert 49.8±1.47µs 49.6±1.61µs -0.40%
ops/text/yrs/remove 2.9±0.11µs 2.8±0.07µs -3.45%
update/parse with jwst/basic.bin 92.2±2.95µs 76.7±2.40µs -16.81%
update/parse with jwst/database.bin 73.3±2.40µs 61.5±1.57µs -16.10%
update/parse with jwst/large.bin 6.6±0.20ms 5.6±0.12ms -15.15%
update/parse with jwst/with-subdoc.bin 8.6±0.77µs 7.8±0.30µs -9.30%
update/parse with yrs/basic.bin 57.3±2.53µs 57.2±1.71µs -0.17%
update/parse with yrs/database.bin 46.2±1.52µs 45.2±0.91µs -2.16%
update/parse with yrs/large.bin 4.1±0.13ms 4.0±0.10ms -2.44%
update/parse with yrs/with-subdoc.bin 8.4±0.28µs 8.0±0.19µs -4.76%

Benchmark for Windows

Click to view benchmark
Test Base PR %
codec/jwst decode var_int (32 bit) 364.5±28.40µs 402.6±17.81µs +10.45%
codec/jwst decode var_uint (32 bit) 330.2±18.42µs 354.7±17.54µs +7.42%
codec/jwst decode var_uint (64 bit) 305.0±14.80µs 353.9±11.26µs +16.03%
codec/jwst encode var_int (32 bit) 444.2±35.06µs 479.4±17.65µs +7.92%
codec/jwst encode var_uint (32 bit) 291.1±18.19µs 321.1±12.80µs +10.31%
codec/jwst encode var_uint (64 bit) 284.1±18.31µs 318.6±13.21µs +12.14%
codec/lib0 decode var_int (64 bit) 337.5±15.93µs 323.7±11.14µs -4.09%
codec/lib0 decode var_uint (32 bit) 286.1±34.34µs 281.4±12.62µs -1.64%
codec/lib0 decode var_uint (64 bit) 255.0±19.76µs 282.7±13.78µs +10.86%
codec/lib0 encode var_int (64 bit) 477.6±19.73µs 469.9±18.37µs -1.61%
codec/lib0 encode var_uint (32 bit) 341.1±10.88µs 337.1±11.09µs -1.17%
codec/lib0 encode var_uint (64 bit) 283.8±13.96µs 326.8±9.70µs +15.15%
ops/array/jwst/insert 330.4±19.56µs 330.7±10.42µs +0.09%
ops/array/jwst/insert range 441.2±21.39µs 465.7±22.96µs +5.55%
ops/array/jwst/remove 191.6±13.71µs 191.6±5.76µs -0.00%
ops/array/yrs/insert 114.2±6.21µs 126.6±5.43µs +10.86%
ops/array/yrs/insert range 166.3±8.80µs 173.3±4.95µs +4.21%
ops/array/yrs/remove 171.6±5.92µs 181.9±6.28µs +6.00%
ops/text/jwst/insert 191.0±6.92µs 184.7±6.71µs -3.30%
ops/text/jwst/remove 5.1±0.25µs 5.4±0.14µs +5.88%
ops/text/yrs/insert 51.0±1.71µs 54.3±2.61µs +6.47%
ops/text/yrs/remove 4.7±0.21µs 5.3±0.19µs +12.77%
update/parse with jwst/basic.bin 120.6±12.41µs 98.0±4.03µs -18.74%
update/parse with jwst/database.bin 88.1±7.97µs 76.9±2.69µs -12.71%
update/parse with jwst/large.bin 5.1±0.21ms 4.8±0.22ms -5.88%
update/parse with jwst/with-subdoc.bin 17.9±1.08µs 14.9±0.45µs -16.76%
update/parse with yrs/basic.bin 72.6±5.57µs 80.0±4.17µs +10.19%
update/parse with yrs/database.bin 54.2±6.20µs 60.8±3.30µs +12.18%
update/parse with yrs/large.bin 3.6±0.22ms 3.7±0.86ms +2.78%
update/parse with yrs/with-subdoc.bin 14.4±0.42µs 13.0±0.43µs -9.72%

@Brooooooklyn Brooooooklyn merged commit ae25ddc into main Sep 16, 2023
13 checks passed
@Brooooooklyn Brooooooklyn deleted the refactor/map branch September 16, 2023 00:48
darkskygit added a commit to toeverything/OctoBase that referenced this pull request Sep 27, 2023
* refactor: re-implement map type (y-crdt/y-octo#26)

* feat: node binding impl (y-crdt/y-octo#6)

* feat: node binding part 1

* feat: add text editing support

* feat: array editing

* feat: add map binding

* feat: add apis for benchmark

* feat: process array correctly

* feat: insert object in map

* chore: cleanup codes

* feat: rename clearly params

* test: don’t tolerate optional values in testing

* feat: create anonymous array/map/text

* feat: get ytype dynamically

* feat: add some compatibility test with yjs

* feat: map interoperability for yjs

* fix: lint

* feat: move compatibility test to utils (y-crdt/y-octo#27)

* fix: merge error

---------

Co-authored-by: liuyi <forehalo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants