Skip to content

Some small simplifications #113

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

Merged
merged 1 commit into from
Aug 7, 2018
Merged

Some small simplifications #113

merged 1 commit into from
Aug 7, 2018

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Aug 7, 2018

benches show nothing out of the ordinary:

 name                               smallvecbench.txt ns/iter  smallvecbench-new.txt ns/iter  diff ns/iter   diff %  speedup
 bench_extend                       47                         47                                        0    0.00%   x 1.00
 bench_extend_from_slice            41                         41                                        0    0.00%   x 1.00
 bench_extend_from_slice_small      12                         12                                        0    0.00%   x 1.00
 bench_extend_from_slice_vec        55                         55                                        0    0.00%   x 1.00
 bench_extend_from_slice_vec_small  25                         25                                        0    0.00%   x 1.00
 bench_extend_small                 13                         13                                        0    0.00%   x 1.00
 bench_extend_vec                   66                         58                                       -8  -12.12%   x 1.14
 bench_extend_vec_small             24                         24                                        0    0.00%   x 1.00
 bench_from_slice                   80                         80                                        0    0.00%   x 1.00
 bench_from_slice_small             22                         23                                        1    4.55%   x 0.96
 bench_from_slice_vec               32                         30                                       -2   -6.25%   x 1.07
 bench_from_slice_vec_small         27                         27                                        0    0.00%   x 1.00
 bench_insert                       618                        605                                     -13   -2.10%   x 1.02
 bench_insert_from_slice            85                         85                                        0    0.00%   x 1.00
 bench_insert_many                  177                        177                                       0    0.00%   x 1.00
 bench_insert_small                 119                        120                                       1    0.84%   x 0.99
 bench_insert_vec                   541                        542                                       1    0.18%   x 1.00
 bench_insert_vec_small             123                        125                                       2    1.63%   x 0.98
 bench_macro_from_elem              35                         34                                       -1   -2.86%   x 1.03
 bench_macro_from_elem_small        7                          7                                         0    0.00%   x 1.00
 bench_macro_from_elem_vec          40                         34                                       -6  -15.00%   x 1.18
 bench_macro_from_elem_vec_small    27                         27                                        0    0.00%   x 1.00
 bench_macro_from_list              21                         22                                        1    4.76%   x 0.95
 bench_macro_from_list_vec          20                         21                                        1    5.00%   x 0.95
 bench_push                         388                        386                                      -2   -0.52%   x 1.01
 bench_push_small                   65                         66                                        1    1.54%   x 0.98
 bench_push_vec                     335                        338                                       3    0.90%   x 0.99
 bench_push_vec_small               44                         46                                        2    4.55%   x 0.96
 bench_pushpop                      746                        746                                       0    0.00%   x 1.00
 bench_pushpop_vec                  247                        247                                       0    0.00%   x 1.00
 bench_remove                       414                        411                                      -3   -0.72%   x 1.01
 bench_remove_small                 89                         90                                        1    1.12%   x 0.99
 bench_remove_vec                   424                        406                                     -18   -4.25%   x 1.04
 bench_remove_vec_small             80                         81                                        1    1.25%   x 0.99

This change is Reviewable

benches show nothing out of the ordinary:

```
 name                               smallvecbench.txt ns/iter  smallvecbench-new.txt ns/iter  diff ns/iter   diff %  speedup
 bench_extend                       47                         47                                        0    0.00%   x 1.00
 bench_extend_from_slice            41                         41                                        0    0.00%   x 1.00
 bench_extend_from_slice_small      12                         12                                        0    0.00%   x 1.00
 bench_extend_from_slice_vec        55                         55                                        0    0.00%   x 1.00
 bench_extend_from_slice_vec_small  25                         25                                        0    0.00%   x 1.00
 bench_extend_small                 13                         13                                        0    0.00%   x 1.00
 bench_extend_vec                   66                         58                                       -8  -12.12%   x 1.14
 bench_extend_vec_small             24                         24                                        0    0.00%   x 1.00
 bench_from_slice                   80                         80                                        0    0.00%   x 1.00
 bench_from_slice_small             22                         23                                        1    4.55%   x 0.96
 bench_from_slice_vec               32                         30                                       -2   -6.25%   x 1.07
 bench_from_slice_vec_small         27                         27                                        0    0.00%   x 1.00
 bench_insert                       618                        605                                     -13   -2.10%   x 1.02
 bench_insert_from_slice            85                         85                                        0    0.00%   x 1.00
 bench_insert_many                  177                        177                                       0    0.00%   x 1.00
 bench_insert_small                 119                        120                                       1    0.84%   x 0.99
 bench_insert_vec                   541                        542                                       1    0.18%   x 1.00
 bench_insert_vec_small             123                        125                                       2    1.63%   x 0.98
 bench_macro_from_elem              35                         34                                       -1   -2.86%   x 1.03
 bench_macro_from_elem_small        7                          7                                         0    0.00%   x 1.00
 bench_macro_from_elem_vec          40                         34                                       -6  -15.00%   x 1.18
 bench_macro_from_elem_vec_small    27                         27                                        0    0.00%   x 1.00
 bench_macro_from_list              21                         22                                        1    4.76%   x 0.95
 bench_macro_from_list_vec          20                         21                                        1    5.00%   x 0.95
 bench_push                         388                        386                                      -2   -0.52%   x 1.01
 bench_push_small                   65                         66                                        1    1.54%   x 0.98
 bench_push_vec                     335                        338                                       3    0.90%   x 0.99
 bench_push_vec_small               44                         46                                        2    4.55%   x 0.96
 bench_pushpop                      746                        746                                       0    0.00%   x 1.00
 bench_pushpop_vec                  247                        247                                       0    0.00%   x 1.00
 bench_remove                       414                        411                                      -3   -0.72%   x 1.01
 bench_remove_small                 89                         90                                        1    1.12%   x 0.99
 bench_remove_vec                   424                        406                                     -18   -4.25%   x 1.04
 bench_remove_vec_small             80                         81                                        1    1.25%   x 0.99
```
}
}
}
self.iter.next().map(|reference| unsafe { ptr::read(reference) })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Normally I would suggest ptr::read(self.iter.next()?) but this requires Rust 1.22, and it's not raising the minimum Rust version for this crate yet.

@mbrubeck
Copy link
Collaborator

mbrubeck commented Aug 7, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 4d02e41 has been approved by mbrubeck

bors-servo pushed a commit that referenced this pull request Aug 7, 2018
Some small simplifications

benches show nothing out of the ordinary:

```
 name                               smallvecbench.txt ns/iter  smallvecbench-new.txt ns/iter  diff ns/iter   diff %  speedup
 bench_extend                       47                         47                                        0    0.00%   x 1.00
 bench_extend_from_slice            41                         41                                        0    0.00%   x 1.00
 bench_extend_from_slice_small      12                         12                                        0    0.00%   x 1.00
 bench_extend_from_slice_vec        55                         55                                        0    0.00%   x 1.00
 bench_extend_from_slice_vec_small  25                         25                                        0    0.00%   x 1.00
 bench_extend_small                 13                         13                                        0    0.00%   x 1.00
 bench_extend_vec                   66                         58                                       -8  -12.12%   x 1.14
 bench_extend_vec_small             24                         24                                        0    0.00%   x 1.00
 bench_from_slice                   80                         80                                        0    0.00%   x 1.00
 bench_from_slice_small             22                         23                                        1    4.55%   x 0.96
 bench_from_slice_vec               32                         30                                       -2   -6.25%   x 1.07
 bench_from_slice_vec_small         27                         27                                        0    0.00%   x 1.00
 bench_insert                       618                        605                                     -13   -2.10%   x 1.02
 bench_insert_from_slice            85                         85                                        0    0.00%   x 1.00
 bench_insert_many                  177                        177                                       0    0.00%   x 1.00
 bench_insert_small                 119                        120                                       1    0.84%   x 0.99
 bench_insert_vec                   541                        542                                       1    0.18%   x 1.00
 bench_insert_vec_small             123                        125                                       2    1.63%   x 0.98
 bench_macro_from_elem              35                         34                                       -1   -2.86%   x 1.03
 bench_macro_from_elem_small        7                          7                                         0    0.00%   x 1.00
 bench_macro_from_elem_vec          40                         34                                       -6  -15.00%   x 1.18
 bench_macro_from_elem_vec_small    27                         27                                        0    0.00%   x 1.00
 bench_macro_from_list              21                         22                                        1    4.76%   x 0.95
 bench_macro_from_list_vec          20                         21                                        1    5.00%   x 0.95
 bench_push                         388                        386                                      -2   -0.52%   x 1.01
 bench_push_small                   65                         66                                        1    1.54%   x 0.98
 bench_push_vec                     335                        338                                       3    0.90%   x 0.99
 bench_push_vec_small               44                         46                                        2    4.55%   x 0.96
 bench_pushpop                      746                        746                                       0    0.00%   x 1.00
 bench_pushpop_vec                  247                        247                                       0    0.00%   x 1.00
 bench_remove                       414                        411                                      -3   -0.72%   x 1.01
 bench_remove_small                 89                         90                                        1    1.12%   x 0.99
 bench_remove_vec                   424                        406                                     -18   -4.25%   x 1.04
 bench_remove_vec_small             80                         81                                        1    1.25%   x 0.99
```

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/113)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

⌛ Testing commit 4d02e41 with merge 371531f...

@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: mbrubeck
Pushing 371531f to master...

@bors-servo bors-servo merged commit 4d02e41 into servo:master Aug 7, 2018
@llogiq llogiq deleted the simplify branch August 7, 2018 19:15
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Aug 22, 2018
Change log:

* servo#118 - optimize `from_slice`
* servo#115 - add `into_inner` method
* Some code cleanup and testing improvements (servo#112, servo#113, servo#114, servo#120)
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Aug 22, 2018
Change log:

* servo#115 - add `into_inner` method
* servo#117 - add `from_buf_and_len` and `from_buf_and_len_unchecked`
* servo#118 - optimize `from_slice`
* Some code cleanup and testing improvements (servo#112, servo#113, servo#114, servo#120)
@mbrubeck mbrubeck mentioned this pull request Aug 22, 2018
bors-servo pushed a commit that referenced this pull request Aug 22, 2018
Version 0.6.5

Change log:

* #115 - add `into_inner` method
* #117 - add `from_buf_and_len` and `from_buf_and_len_unchecked`
* #118 - optimize `from_slice`
* Some code cleanup and testing improvements (#112, #113, #114, #120)

cc @llogiq

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/121)
<!-- Reviewable:end -->
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.

4 participants