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

feat: allow filter object fields inside an array #337

Merged
merged 4 commits into from
Oct 22, 2023

Conversation

0x0a0d
Copy link
Contributor

@0x0a0d 0x0a0d commented Dec 20, 2022

use .$. to deeply filter fields in array elements
please look at test

cars.$.wheels.$.histories.$.date is used to get date property of histories, which is an array property of wheels - which, again, is an array property of cars

@0x0a0d 0x0a0d closed this Feb 14, 2023
@0x0a0d 0x0a0d deleted the cylution/fix-fields-unsafe branch February 14, 2023 11:51
@0x0a0d 0x0a0d restored the cylution/fix-fields-unsafe branch February 14, 2023 12:05
@0x0a0d 0x0a0d reopened this Feb 14, 2023
@icebob
Copy link
Member

icebob commented Feb 19, 2023

Please make and publish a benchmark test between the master and in your PR branch to see how this new get logic affects the performance.

@0x0a0d
Copy link
Contributor Author

0x0a0d commented Oct 10, 2023

@icebob could you give me instructions on how to create a benchmark?

@icebob
Copy link
Member

icebob commented Oct 22, 2023

I've created a benchmark in master branch what you can execute with npm run bench command.

@0x0a0d
Copy link
Contributor Author

0x0a0d commented Oct 22, 2023

Thanks @icebob, here is bench in my pc

3.5 GHz Quad-Core Intel Core i7
16 GB 1600 MHz DDR3

Result files

master.log
pull-request.log


Entity Creation

Master

  • NeDB (file): 3,680 ops/sec
  • SQLite (memory): 2,130 ops/sec
  • Difference: NeDB is 42.12% faster than SQLite

Pull-request

  • NeDB (file): 3,695 ops/sec (0.41% increase)
  • SQLite (memory): 2,147 ops/sec (0.80% increase)
  • Difference: NeDB is 41.9% faster than SQLite

Entity Finding

Master

  • NeDB (file): 4,455 ops/sec
  • SQLite (memory): 1,193 ops/sec
  • Difference: NeDB is 73.21% faster than SQLite

Pull-request

  • NeDB (file): 4,360 ops/sec (2.13% decrease)
  • SQLite (memory): 1,225 ops/sec (2.68% increase)
  • Difference: NeDB is 71.9% faster than SQLite

Entity Listing

Master

  • NeDB (file): 1,390 ops/sec
  • SQLite (memory): 910 ops/sec
  • Difference: NeDB is 34.53% faster than SQLite

Pull-request

  • NeDB (file): 1,355 ops/sec (2.52% decrease)
  • SQLite (memory): 881 ops/sec (3.18% decrease)
  • Difference: NeDB is 34.98% faster than SQLite

Entity Counting

Master

  • NeDB (file): 1,969 ops/sec
  • SQLite (memory): 2,791 ops/sec
  • Difference: SQLite is 29.44% faster than NeDB

Pull-request

  • NeDB (file): 1,755 ops/sec (10.86% decrease)
  • SQLite (memory): 2,712 ops/sec (2.83% decrease)
  • Difference: SQLite is 35.29% faster than NeDB

Entity Getting

Master

  • NeDB (file): 12,948 ops/sec
  • SQLite (memory): 2,078 ops/sec
  • Difference: NeDB is 83.95% faster than SQLite

Pull-request

  • NeDB (file): 13,111 ops/sec (1.26% increase)
  • SQLite (memory): 2,119 ops/sec (1.97% increase)
  • Difference: NeDB is 83.84% faster than SQLite

Entity Updating

Master

  • NeDB (file): 2,984 ops/sec
  • SQLite (memory): 1,254 ops/sec
  • Difference: NeDB is 57.96% faster than SQLite

Pull-request

  • NeDB (file): 3,685 ops/sec (23.51% increase)
  • SQLite (memory): 1,398 ops/sec (11.48% increase)
  • Difference: NeDB is 62.08% faster than SQLite

Entity Deleting

Master

NeDB (file): 21,769 ops/sec

  • SQLite (memory): 2,693 ops/sec
  • Difference: NeDB is 87.41% faster than SQLite

Pull-request

  • NeDB (file): 24,163 ops/sec (11.01% increase)
  • SQLite (memory): 5,826 ops/sec (116.29% increase)
  • Difference: NeDB is 73.37% faster than SQLite

@icebob
Copy link
Member

icebob commented Oct 22, 2023

Great, thank you.

@icebob icebob merged commit 2702ad1 into moleculerjs:master Oct 22, 2023
5 checks passed
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.

2 participants