Timeline for Function takes hugely different times to evaluate on sets of virtually (but also literally) identical data
Current License: CC BY-SA 3.0
Post Revisions
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 6, 2015 at 22:56 | history | tweeted | twitter.com/#!/StackMma/status/563833753035112449 | ||
| Feb 6, 2015 at 17:07 | vote | accept | CupiDio | ||
| Feb 6, 2015 at 17:04 | comment | added | Mr.Wizard | I posted an answer attempting to detail both the origin of the problem and several work-arounds. | |
| Feb 6, 2015 at 17:00 | answer | added | Mr.Wizard | timeline score: 9 | |
| Feb 6, 2015 at 16:56 | comment | added | CupiDio | Great! Using Developer`ToPackedArray /@ slow solved the problem! | |
| Feb 6, 2015 at 16:52 | comment | added | Mr.Wizard |
Sorry, I just realized that you included data generation in the question! I skimmed it and thought you were importing external data. The sub-lists in fast are packed: Developer`PackedArrayQ /@ fast
|
|
| Feb 6, 2015 at 16:50 | comment | added | CupiDio | Returns {False, False} | |
| Feb 6, 2015 at 16:49 | comment | added | Mr.Wizard |
Hm... That should rule out the exact/inexact numbers possibility but it leaves packed arrays. What do you get from Developer`PackedArrayQ /@ {data2, data3}?
|
|
| Feb 6, 2015 at 16:47 | history | edited | CupiDio | CC BY-SA 3.0 |
added 1 character in body
|
| Feb 6, 2015 at 16:47 | comment | added | CupiDio | But also data2===data3 yields true. Is this enough? I'll edit the question with this anyway! | |
| Feb 6, 2015 at 16:46 | comment | added | Mr.Wizard | Also, one of the sets may be a packed array while the other is not. Packed arrays, if supported by the functions involved, will be processed more quickly. | |
| Feb 6, 2015 at 16:44 | comment | added | Mr.Wizard |
data2 == data3 yielding True does not indicate that the data is the same, only numerically equivalent. For example if one set of data contains exact numbers (e.g. Integer, Rational) this set may be processed with exact arithmetic which is often far slower.
|
|
| Feb 6, 2015 at 16:23 | history | asked | CupiDio | CC BY-SA 3.0 |