Comments (1)
Thanks for your feedback!
I agree with you that current from_slice
imprementation is inconsistent. Slices with repeated indices may cause it use more memory than expected.
We have several options to solve this:
- Trace the max index and add a
shirk_to
before return. - Change initial length to
slice.max()
to avoid any allocation. - Change initial length to
0
make sure no memory is wasted.
I did some benches on these solutions, and it shows that the first one has better performance over others.
I'll make a patch later with the first solution and thanks for your feedback again!
from_slice, small set, capacity=slice.len()
time: [6.7193 us 6.7212 us 6.7232 us]
change: [+0.6780% +0.9091% +1.1639%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 21 outliers among 100 measurements (21.00%)
3 (3.00%) low severe
5 (5.00%) low mild
5 (5.00%) high mild
8 (8.00%) high severe
from_slice, small set, capacity=slice.max()
time: [6.8733 us 6.8753 us 6.8776 us]
change: [-0.2958% -0.1312% +0.0648%] (p = 0.18 > 0.05)
No change in performance detected.
Found 11 outliers among 100 measurements (11.00%)
1 (1.00%) low mild
3 (3.00%) high mild
7 (7.00%) high severe
from_slice, small set, capacity=0
time: [6.8792 us 6.8811 us 6.8833 us]
change: [-0.3338% -0.0785% +0.1143%] (p = 0.56 > 0.05)
No change in performance detected.
Found 6 outliers among 100 measurements (6.00%)
2 (2.00%) high mild
4 (4.00%) high severe
from_slice, large set, capacity=slice.len()
time: [121.72 us 121.84 us 121.95 us]
change: [+0.3143% +0.4387% +0.5645%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
from_slice, large set, capacity=slice.max()
time: [123.99 us 124.12 us 124.24 us]
change: [-0.4949% -0.3700% -0.2379%] (p = 0.00 < 0.05)
Change within noise threshold.
from_slice, large set, capacity=0
time: [124.02 us 124.15 us 124.28 us]
change: [-0.4067% -0.2901% -0.1640%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high severe
from bitvector_simd.
Related Issues (2)
- no len()? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitvector_simd.