1
- #[ cfg( feature = "nightly" ) ]
2
1
use pyo3:: {
3
2
prelude:: * ,
4
3
types:: { IntoPyDict , PyModule } ,
5
4
} ;
6
5
use sprs:: smmp;
7
6
use sprs_rand:: rand_csr_std;
8
7
9
- #[ cfg( feature = "nightly" ) ]
10
8
fn scipy_mat < ' a > (
11
9
scipy_sparse : & ' a PyModule ,
12
10
py : & Python ,
@@ -155,11 +153,8 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
155
153
} ,
156
154
] ;
157
155
158
- #[ cfg( feature = "nightly" ) ]
159
156
let gil = Python :: acquire_gil ( ) ;
160
- #[ cfg( feature = "nightly" ) ]
161
157
let py = gil. python ( ) ;
162
- #[ cfg( feature = "nightly" ) ]
163
158
let scipy_sparse = PyModule :: import ( py, "scipy.sparse" ) . map_err ( |e| {
164
159
let res = format ! ( "Python error: {:?}" , e) ;
165
160
e. print_and_set_sys_last_vars ( py) ;
@@ -169,7 +164,7 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
169
164
for spec in & bench_specs {
170
165
let shape = spec. shape ;
171
166
172
- let is_shape_bench = spec. shapes . len ( ) != 0 ;
167
+ let is_shape_bench = ! spec. shapes . is_empty ( ) ;
173
168
let densities = if is_shape_bench {
174
169
spec. shapes
175
170
. iter ( )
@@ -190,7 +185,6 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
190
185
let mut times_autothread = Vec :: with_capacity ( densities. len ( ) ) ;
191
186
let mut times_2threads = Vec :: with_capacity ( densities. len ( ) ) ;
192
187
let mut times_4threads = Vec :: with_capacity ( densities. len ( ) ) ;
193
- #[ cfg( feature = "nightly" ) ]
194
188
let mut times_py = Vec :: with_capacity ( densities. len ( ) ) ;
195
189
#[ cfg( feature = "eigen" ) ]
196
190
let mut times_eigen = Vec :: with_capacity ( densities. len ( ) ) ;
@@ -261,7 +255,6 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
261
255
res_densities. push ( prod. density ( ) ) ;
262
256
263
257
// bench scipy as well
264
- #[ cfg( feature = "nightly" ) ]
265
258
{
266
259
let m1_py = scipy_mat ( scipy_sparse, & py, & m1) ?;
267
260
let m2_py = scipy_mat ( scipy_sparse, & py, & m2) ?;
@@ -307,7 +300,6 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
307
300
println ! ( "Product times (sprs, 2 threads): {:?}" , times_2threads) ;
308
301
println ! ( "Product times (sprs, 4 threads): {:?}" , times_4threads) ;
309
302
println ! ( "Product times (sprs, auto threads): {:?}" , times_autothread) ;
310
- #[ cfg( feature = "nightly" ) ]
311
303
println ! ( "Product times (scipy): {:?}" , times_py) ;
312
304
#[ cfg( feature = "eigen" ) ]
313
305
println ! ( "Product times (eigen): {:?}" , times_eigen) ;
@@ -352,7 +344,6 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
352
344
max_time,
353
345
* times_eigen. iter ( ) . max ( ) . unwrap_or ( & 1 ) ,
354
346
) ;
355
- #[ cfg( feature = "nightly" ) ]
356
347
let max_time =
357
348
std:: cmp:: max ( max_time, * times_py. iter ( ) . max ( ) . unwrap_or ( & 1 ) ) ;
358
349
let max_time = max_time as f32 ;
@@ -423,7 +414,6 @@ fn bench_densities() -> Result<(), Box<dyn std::error::Error>> {
423
414
PathElement :: new ( vec ! [ ( x, y) , ( x + 20 , y) ] , & BLUE )
424
415
} ) ;
425
416
426
- #[ cfg( feature = "nightly" ) ]
427
417
chart
428
418
. draw_series ( LineSeries :: new (
429
419
abscisses
0 commit comments