![]() ![]() I can't know for sure, but I think Pick has some special routines for the case the first the arguments are packed and the pattern 'simple'. Pick is much faster and outputs a packed array. $HistoryLength = 1 ĪbsoluteTiming], list, Max] ]ĪbsoluteTiming] ]Įxplicitly converting it to a non-packed array, you see that Position is faster. Position does not have such optimisations. a number), and that the 'list' and 'sel' lists (the first two arguments) are packed arrays. I think it is entirely to 'blame' that Pick has a few optimisations for the case that the pattern (Max in this case) is 'simple'. I would've expected also that Position would be faster. But for those kind of problems like the current, I would use it anyway with excessive comments explaining what it exactly does. Within such contexts this kind of programming can be a nightmare, since nobody understands the code without reverse engineering. I have a background as developer, project leader, architect of really big software systems with many developers and maintenance people. The price you pay is readability and hence maintainability. As you can see from my example code above, I do not really like that, except for special really performance-critical circumstances. Just as a kind of sidestep concerning functional programming: I know of course that in such languages as WL one can achieve large performance gains by formulating complicated, very tricky one-liners. And if we can convince Wolfram to optimize some of its internal code - even better! I have learned a lot and will use the best of your hints. I am impressed on your engagement and your results. Thank you all very much for your contributions. Finance, Statistics & Business Analysis.Wolfram Knowledgebase Curated computable knowledge powering Wolfram|Alpha. Wolfram Universal Deployment System Instant deployment across cloud, desktop, mobile, and more. ![]() ![]() Wolfram Data Framework Semantic framework for real-world data. ![]()
0 Comments
Leave a Reply. |