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

Subset of perf numbers #6

Closed
wants to merge 1 commit into from
Closed

Subset of perf numbers #6

wants to merge 1 commit into from

Conversation

epage
Copy link
Member

@epage epage commented Jul 8, 2021

  • Tests created for any new feature or regression tests for bugfixes.

@epage
Copy link
Member Author

epage commented Jul 8, 2021

Small string clone:

clone/&'static str/10   time:   [521.89 ps 528.41 ps 535.47 ps]
                        thrpt:  [17.393 GiB/s 17.625 GiB/s 17.845 GiB/s]
Found 10 outliers among 100 measurements (10.00%)
  8 (8.00%) high mild
  2 (2.00%) high severe

clone/String/10         time:   [16.616 ns 16.796 ns 16.991 ns]
                        thrpt:  [561.29 MiB/s 567.80 MiB/s 573.94 MiB/s]
Found 6 outliers among 100 measurements (6.00%)
  3 (3.00%) high mild
  3 (3.00%) high severe

clone/Box<str>/10       time:   [15.841 ns 16.236 ns 16.657 ns]
                        thrpt:  [572.55 MiB/s 587.40 MiB/s 602.03 MiB/s]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe

clone/StringCow::Borrowed/10
                        time:   [870.00 ps 888.83 ps 910.47 ps]
                        thrpt:  [10.229 GiB/s 10.478 GiB/s 10.705 GiB/s]
Found 12 outliers among 100 measurements (12.00%)
  7 (7.00%) high mild
  5 (5.00%) high severe

clone/StringCow::Owned/10
                        time:   [16.388 ns 16.714 ns 17.070 ns]
                        thrpt:  [558.70 MiB/s 570.57 MiB/s 581.94 MiB/s]
Found 9 outliers among 100 measurements (9.00%)
  7 (7.00%) high mild
  2 (2.00%) high severe

clone/KString::from_static/10
                        time:   [9.7366 ns 9.8585 ns 9.9980 ns]
                        thrpt:  [953.86 MiB/s 967.36 MiB/s 979.48 MiB/s]
Found 7 outliers among 100 measurements (7.00%)
  5 (5.00%) high mild
  2 (2.00%) high severe

clone/KString::from_ref/10
                        time:   [10.266 ns 10.544 ns 10.804 ns]
                        thrpt:  [882.72 MiB/s 904.45 MiB/s 928.92 MiB/s]
Found 14 outliers among 100 measurements (14.00%)
  9 (9.00%) high mild
  5 (5.00%) high severe

clone/KString::from_string/10
                        time:   [10.002 ns 10.192 ns 10.387 ns]
                        thrpt:  [918.13 MiB/s 935.67 MiB/s 953.50 MiB/s]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

This puts KString between StringCow and String. I would have liked to see the numbers closer to StringCow for at least KString::from_static. Something fishy is going on.

@epage
Copy link
Member Author

epage commented Jul 8, 2021

Heap string clone:

clone/&'static str/40   time:   [536.73 ps 541.49 ps 546.67 ps]
                        thrpt:  [68.145 GiB/s 68.797 GiB/s 69.407 GiB/s]
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe

clone/String/40         time:   [17.300 ns 17.693 ns 18.123 ns]
                        thrpt:  [2.0555 GiB/s 2.1055 GiB/s 2.1533 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild

clone/Box<str>/40       time:   [16.617 ns 16.942 ns 17.321 ns]
                        thrpt:  [2.1507 GiB/s 2.1988 GiB/s 2.2419 GiB/s]
Found 16 outliers among 100 measurements (16.00%)
  5 (5.00%) high mild
  11 (11.00%) high severe

clone/StringCow::Borrowed/40
                        time:   [921.19 ps 937.44 ps 954.34 ps]
                        thrpt:  [39.035 GiB/s 39.739 GiB/s 40.440 GiB/s]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild

clone/StringCow::Owned/40
                        time:   [17.140 ns 17.450 ns 17.791 ns]
                        thrpt:  [2.0939 GiB/s 2.1349 GiB/s 2.1734 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild

clone/KString::from_static/40
                        time:   [9.8675 ns 10.042 ns 10.231 ns]
                        thrpt:  [3.6412 GiB/s 3.7095 GiB/s 3.7753 GiB/s]
Found 5 outliers among 100 measurements (5.00%)
  3 (3.00%) high mild
  2 (2.00%) high severe

clone/KString::from_ref/40
                        time:   [28.084 ns 28.760 ns 29.467 ns]
                        thrpt:  [1.2642 GiB/s 1.2953 GiB/s 1.3265 GiB/s]
Found 9 outliers among 100 measurements (9.00%)
  6 (6.00%) high mild
  3 (3.00%) high severe

clone/KString::from_string/40
                        time:   [27.175 ns 27.481 ns 27.843 ns]
                        thrpt:  [1.3380 GiB/s 1.3556 GiB/s 1.3708 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) high mild
  2 (2.00%) high severe

If we consider KString::from_static's 10ns to be a fixed overhead, that explains KString::from_strings numbers. The question is, where is that overhead coming from and how can we remove it?

@epage
Copy link
Member Author

epage commented Jul 8, 2021

str access:

access/&'static str/10  time:   [274.64 ps 277.94 ps 281.59 ps]
                        thrpt:  [33.073 GiB/s 33.508 GiB/s 33.911 GiB/s]
Found 13 outliers among 100 measurements (13.00%)
  10 (10.00%) high mild
  3 (3.00%) high severe

access/String/10        time:   [265.68 ps 269.47 ps 273.53 ps]
                        thrpt:  [34.048 GiB/s 34.561 GiB/s 35.054 GiB/s]

access/Box<str>/10      time:   [268.34 ps 271.97 ps 276.16 ps]
                        thrpt:  [33.724 GiB/s 34.244 GiB/s 34.706 GiB/s]
Found 5 outliers among 100 measurements (5.00%)
  5 (5.00%) high mild

access/StringCow::Borrowed/10
                        time:   [302.50 ps 311.29 ps 320.43 ps]
                        thrpt:  [29.065 GiB/s 29.919 GiB/s 30.788 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild

access/StringCow::Owned/10
                        time:   [373.45 ps 416.94 ps 456.59 ps]
                        thrpt:  [20.397 GiB/s 22.337 GiB/s 24.939 GiB/s]
Found 16 outliers among 100 measurements (16.00%)
  9 (9.00%) high mild
  7 (7.00%) high severe

access/KString::from_static/10
                        time:   [496.05 ps 505.16 ps 514.33 ps]
                        thrpt:  [18.108 GiB/s 18.436 GiB/s 18.775 GiB/s]

access/KString::from_ref/10
                        time:   [274.93 ps 279.01 ps 284.10 ps]
                        thrpt:  [32.781 GiB/s 33.379 GiB/s 33.875 GiB/s]
Found 10 outliers among 100 measurements (10.00%)
  9 (9.00%) high mild
  1 (1.00%) high severe

access/KString::from_string/10
                        time:   [271.60 ps 276.19 ps 281.01 ps]
                        thrpt:  [33.142 GiB/s 33.720 GiB/s 34.290 GiB/s]

access/KString::from_ref/40
                        time:   [271.00 ps 274.25 ps 277.64 ps]
                        thrpt:  [134.18 GiB/s 135.83 GiB/s 137.46 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
  3 (3.00%) high mild

access/KString::from_string/40
                        time:   [277.19 ps 282.71 ps 288.62 ps]
                        thrpt:  [129.07 GiB/s 131.77 GiB/s 134.40 GiB/s]
Found 3 outliers among 100 measurements (3.00%)
  2 (2.00%) high mild
  1 (1.00%) high severe

My guess is between StringCow and KString::from_static I had something happening on my machine because those numbers shouldn't be any different than the rest.

With that assumption, we don't really add noticeable overhead in using the underlying str. If this is the case, we should see similar in clone since they should both just be jump tables. So why is clone so slow?

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