Which has faster performance indexesOfObjectsPassingTest or filteredArrayUsingPredicate?

The following tests (compiled in Release mode, executed on a Mac Pro) indicate that filteredArrayUsingPredicate is slower than indexesOfObjectsPassingTest if you use a “textual” predicate, but faster if you use block-based predicate. The fasted method in my test was a simple (fast-enumeration) loop that adds all matching objects to a mutable array. Results for filtering … Read more

Preventing compiler optimizations while benchmarking

tl;dr doNotOptimizeAway creates an artificial “use”s. A little bit of terminology here: a “def” (“definition”) is a statement, which assigns a value to a variable; a “use” is a statement, which uses the value of a variable to perform some operation. If from the point immediately after a def, all the paths to the program … Read more

Why is TensorFlow 2 much slower than TensorFlow 1?

UPDATE 8/1730/2020: TF 2.3 has finally done it: all cases run as fast, or notably faster, than any previous version. Further, my previous update was unfair to TF; my GPU was to blame, has been overheating lately. If you see a rising stem plot of iteration times, it’s a reliable symptom. Lastly, see a dev’s … Read more