Timeline for Timing: extracting from List VS extracting from Association
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 28, 2018 at 2:05 | vote | accept | anderstood | ||
Apr 1, 2018 at 17:30 | comment | added | Michael E2 |
Lookup[assoc, 10] is consistently a little faster than assoc[10] for me.
|
|
Apr 1, 2018 at 9:28 | comment | added | Szabolcs |
The benchmark in my comment above is flawed. Part is faster because of auto-compilation. Change Range[100] to Range[99] and association lookup becomes almost precisely 2x faster than list indexing. I wonder if it has any significance that the factor is almost precisely 2.
|
|
Apr 1, 2018 at 9:20 | comment | added | Szabolcs |
I am not convinced that association-lookup is really faster. It could be some timing artefact. It is not easy to time such extremely short operations accurately. list[[#]] & /@ Range[100] is 9 times faster on my machine than assoc /@ Range[100] .
|
|
Apr 1, 2018 at 9:00 | history | tweeted | twitter.com/StackMma/status/980369186273808384 | ||
Apr 1, 2018 at 8:47 | answer | added | Henrik Schumacher | timeline score: 5 | |
Apr 1, 2018 at 5:48 | answer | added | Mitch | timeline score: 1 | |
Apr 1, 2018 at 3:34 | history | edited | anderstood | CC BY-SA 3.0 |
added 104 characters in body
|
Apr 1, 2018 at 3:33 | comment | added | J. M.'s missing motivation♦ |
I was going to mention something about unpacking, but the version using ulst = Developer`FromPackedArray[list] is even slower. Huh.
|
|
Apr 1, 2018 at 3:25 | history | asked | anderstood | CC BY-SA 3.0 |