[mlpack-git] [mlpack/mlpack] Check if SortStruct provides any benefit. (#712)

Ryan Curtin notifications at github.com
Thu Jun 30 13:37:46 EDT 2016


Results on my system with gcc:

```
$ ./main2
SortStruct results:
unnecessaryCodeRemovalPreventer = 1.09092e+08
sort duration = 21890ms
std::pair results:
unnecessaryCodeRemovalPreventer = 1.20977e+08
sort duration = 18936ms
```

and with clang:

```
SortStruct results:
unnecessaryCodeRemovalPreventer = 1.0909e+08
sort duration = 81754ms
std::pair results:
unnecessaryCodeRemovalPreventer = 1.01206e+08
sort duration = 80806ms
```

clang is much slower!  I also had one more test I wanted to do---using the default comparator for `std::pair`.  So I removed the third argument from line 74 of main2.cpp and switched the order of the pair to hold double first then size_t.

gcc:

```
SortStruct results:
unnecessaryCodeRemovalPreventer = 1.09092e+08
sort duration = 21970ms
std::pair results:
unnecessaryCodeRemovalPreventer = 1.26484e+08
sort duration = 19171ms
```

clang:

```

```
SortStruct results:
unnecessaryCodeRemovalPreventer = 1.09091e+08
sort duration = 80945ms
std::pair results:
unnecessaryCodeRemovalPreventer = 1.14581e+08
sort duration = 82204ms
```

So I guess the best solution is to use `std::pair`, but with the lambda, as you have it written.


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/issues/712#issuecomment-229732827
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160630/257909b0/attachment.html>


More information about the mlpack-git mailing list