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

Term indexer benchmark #304

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

Conversation

MBkkt
Copy link
Contributor

@MBkkt MBkkt commented Jan 11, 2023

2023-01-11T10:11:10+01:00
Running /home/mbkkt/projects/s2geometry/cmake-build-relwithdebinfo/s2region_term_indexer_benchmark
Run on (16 X 2400 MHz CPU s)
CPU Caches:
  L1 Data 48 KiB (x8)
  L1 Instruction 32 KiB (x8)
  L2 Unified 1280 KiB (x8)
  L3 Unified 24576 KiB (x1)
Load Average: 0.61, 1.01, 1.11
-----------------------------------------------------------------------
Benchmark                             Time             CPU   Iterations
-----------------------------------------------------------------------
BM_OldApiGetIndexTerms/1            793 ns          793 ns       884327
BM_OldApiGetIndexTerms/4           3182 ns         3181 ns       219929
BM_OldApiGetIndexTerms/16         12713 ns        12705 ns        55232
BM_OldApiGetIndexTerms/64         50698 ns        50672 ns        13792
BM_OldApiGetIndexTerms/256       202620 ns       202513 ns         3454
BM_OldApiGetIndexTerms/1024      811016 ns       810598 ns          866
BM_OldApiGetIndexTerms/4096     3239457 ns      3237847 ns          214
BM_OldApiGetIndexTerms/16384   12970825 ns     12965131 ns           54
BM_OldApiGetIndexTerms/65536   51778520 ns     51755382 ns           13
BM_NewApiGetIndexTerms/1            792 ns          792 ns       886598
BM_NewApiGetIndexTerms/4           2741 ns         2739 ns       255958
BM_NewApiGetIndexTerms/16         10451 ns        10445 ns        66935
BM_NewApiGetIndexTerms/64         41073 ns        41054 ns        17020
BM_NewApiGetIndexTerms/256       165041 ns       164955 ns         4268
BM_NewApiGetIndexTerms/1024      662094 ns       659296 ns         1062
BM_NewApiGetIndexTerms/4096     2632673 ns      2631518 ns          267
BM_NewApiGetIndexTerms/16384   10491220 ns     10486248 ns           66
BM_NewApiGetIndexTerms/65536   42060491 ns     42039968 ns           17
BM_OldApiGetQueryTerms/1            930 ns          930 ns       756008
BM_OldApiGetQueryTerms/4           3700 ns         3698 ns       188112
BM_OldApiGetQueryTerms/16         14813 ns        14806 ns        47031
BM_OldApiGetQueryTerms/64         59246 ns        59220 ns        11771
BM_OldApiGetQueryTerms/256       236687 ns       236571 ns         2945
BM_OldApiGetQueryTerms/1024      950600 ns       950210 ns          734
BM_OldApiGetQueryTerms/4096     3790180 ns      3788441 ns          185
BM_OldApiGetQueryTerms/16384   15195239 ns     15187447 ns           46
BM_OldApiGetQueryTerms/65536   60972786 ns     60943205 ns           11
BM_NewApiGetQueryTerms/1            922 ns          922 ns       761727
BM_NewApiGetQueryTerms/4           3156 ns         3154 ns       222251
BM_NewApiGetQueryTerms/16         12007 ns        12001 ns        58316
BM_NewApiGetQueryTerms/64         47316 ns        47291 ns        14807
BM_NewApiGetQueryTerms/256       188130 ns       188034 ns         3701
BM_NewApiGetQueryTerms/1024      747719 ns       747365 ns          937
BM_NewApiGetQueryTerms/4096     2990343 ns      2988520 ns          234
BM_NewApiGetQueryTerms/16384   11939954 ns     11934530 ns           58
BM_NewApiGetQueryTerms/65536   47797020 ns     47776327 ns           15

auto const count = state.range(0);
for (auto _ : state) {
for (int64_t i = 0; i < count; ++i) {
auto value = indexer.GetIndexTerms(S2Testing::RandomPoint(), {});
Copy link
Member

Choose a reason for hiding this comment

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

You're only testing the S2Point overload. Is that the only one you care about?

For that one, you can easily exactly compute the size you need and reserve it. I will add this and include it in the next PR.

What are the numbers when you do that?

Copy link
Contributor Author

@MBkkt MBkkt Jan 11, 2023

Choose a reason for hiding this comment

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

I wrote answer in other PR.

Benchmarks became same if you make reserve, not because reserve make same it still N allocations instead of 1.
But because it's microbenchmark, and opposite to real code allocator has not other work

You're only testing the S2Point overload.

Not, but it's pretty same if we have covering (I added overload only for such functions)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#303 (comment)

Why is so much resistance about this?

I don't think it's needed for other API, like java or golang, because they care about performance a more little than cpp code

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