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

SizeOfList updates #4014

Closed
wants to merge 1 commit into from
Closed

SizeOfList updates #4014

wants to merge 1 commit into from

Conversation

ironage
Copy link
Contributor

@ironage ironage commented Oct 23, 2020

Fix a bug when evaluating SizeListNode for Lst<Optional<Int>> type which applies to Query::size_*() methods. This is because we were instantiating BPTree where we should be using BPTree<Optional> because it stores a magic null value in the list and subtracts one from the size.

The change to SizeListNode removes one dimension of template instantiation which reduces about 200k from the release library size. The type check is now done at run time, but the benchmark added shows a negligible impact.

Req runs:    6  QueryListOfPrimitiveIntsSize (MemOnly, EncryptionOff):     min  70.96ms (-0.06%)            max  75.05ms (-1.02%)            med  72.46ms (+0.77%)            avg  72.70ms (+0.39%)            stddev  1.65ms (-8.56%)

Base monorepo branch size report:

  ./bloaty -d inputfiles ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/*.o
    FILE SIZE        VM SIZE
 --------------  --------------
  26.3%  1.62Mi  26.9%  1.10Mi    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/query.cpp.o
  12.6%   794Ki  15.6%   650Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/array.cpp.o
  11.5%   721Ki  11.4%   473Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/list.cpp.o
   9.1%   569Ki   8.6%   357Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/table.cpp.o
   7.1%   448Ki   5.9%   247Ki    [35 Others]
   6.8%   426Ki   6.2%   259Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/set.cpp.o
   4.8%   299Ki   4.5%   188Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/obj.cpp.o
   4.3%   272Ki   4.4%   183Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/query_expression.cpp.o
   2.6%   165Ki   2.4%   100Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/cluster.cpp.o
   2.2%   141Ki   1.9%  79.3Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/db.cpp.o
   1.8%   112Ki   1.7%  68.9Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/group.cpp.o
   1.7%   107Ki   1.7%  72.9Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/sort_descriptor.cpp.o
   1.4%  90.1Ki   1.3%  54.2Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/table_view.cpp.o
   1.3%  82.2Ki   1.2%  49.3Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/query_engine.cpp.o
   1.2%  72.5Ki   1.2%  49.0Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/index_string.cpp.o
   1.1%  68.6Ki   1.1%  45.6Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/cluster_tree.cpp.o
   1.0%  63.3Ki   1.1%  45.4Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/array_timestamp.cpp.o
   0.9%  56.0Ki   0.8%  33.2Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/dictionary.cpp.o
   0.8%  52.5Ki   0.8%  33.2Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/alloc_slab.cpp.o
   0.8%  50.1Ki   0.8%  34.0Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/group_writer.cpp.o
   0.6%  35.2Ki   0.4%  17.1Ki    ../realm-core2/build.release/src/realm/CMakeFiles/Storage.dir/table_cluster_tree.cpp.o
 100.0%  6.14Mi 100.0%  4.07Mi    TOTAL

This PR:

 ./bloaty -d inputfiles ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/*.o
    FILE SIZE        VM SIZE
 --------------  --------------
  22.2%  1.32Mi  23.1%   929Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/query.cpp.o
  13.1%   794Ki  16.1%   650Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/array.cpp.o
  11.9%   721Ki  11.7%   473Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/list.cpp.o
   9.4%   569Ki   8.9%   357Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/table.cpp.o
   7.4%   448Ki   6.1%   247Ki    [35 Others]
   7.0%   426Ki   6.4%   259Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/set.cpp.o
   4.9%   299Ki   4.7%   188Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/obj.cpp.o
   4.5%   272Ki   4.6%   183Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/query_expression.cpp.o
   3.1%   186Ki   2.7%   107Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/query_engine.cpp.o
   2.7%   165Ki   2.5%   100Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/cluster.cpp.o
   2.3%   141Ki   2.0%  79.3Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/db.cpp.o
   1.9%   112Ki   1.7%  68.9Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/group.cpp.o
   1.8%   107Ki   1.8%  72.9Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/sort_descriptor.cpp.o
   1.5%  90.1Ki   1.3%  54.2Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/table_view.cpp.o
   1.2%  72.5Ki   1.2%  49.0Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/index_string.cpp.o
   1.1%  68.6Ki   1.1%  45.6Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/cluster_tree.cpp.o
   1.0%  63.3Ki   1.1%  45.4Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/array_timestamp.cpp.o
   0.9%  56.0Ki   0.8%  33.2Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/dictionary.cpp.o
   0.9%  52.5Ki   0.8%  33.2Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/alloc_slab.cpp.o
   0.8%  50.1Ki   0.8%  34.0Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/group_writer.cpp.o
   0.6%  35.1Ki   0.4%  17.0Ki    ../realm-core/build.release/src/realm/CMakeFiles/Storage.dir/table_cluster_tree.cpp.o
 100.0%  5.94Mi 100.0%  3.94Mi    TOTAL

@ironage ironage self-assigned this Oct 23, 2020
@ironage
Copy link
Contributor Author

ironage commented Oct 23, 2020

Closing this one in favour of the v6 version here: #4016
When porting these changes forward, we'll have to add cases for the new data types, but the compiler should warn for missing switch cases, and the updated test covers them too.

@ironage ironage closed this Oct 23, 2020
@ironage ironage deleted the js/size_of_list branch May 12, 2021 22:18
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants