What's the type of data_list in the list comprehension version? --Blake
On Thursday, June 12, 2014 8:13:18 PM UTC-4, John Myles White wrote: > > That’s a shame. Maybe the list comprehension has some typing issues. > > — John > > On Jun 12, 2014, at 5:06 PM, Rich Morin <[email protected] <javascript:>> > wrote: > > On Thursday, June 12, 2014 4:15:44 PM UTC-7, John Myles White wrote: >> >> This line >> >> data_list = map(key -> get(parm_hash, key, ""), prop_list) >> >> could probably be sped up replacing map with a list comprehension, >> > which would also remove the anonymous function. Both map and >> > anonymous functions are slower than you might hope, so removing >> > them can offer meaningful speedups. >> > > I just tried this; sadly, the performance got a lot *worse*: > > 4836 data_list = map(key -> get(parm_hash, key, ""), prop_list) > > 10953 data_list = [ get(parm_hash, key, "") for key in prop_list ] > > >
