On Wed, Nov 25, 2015 at 9:22 PM, Timothy Gu <timothyg...@gmail.com> wrote: > On Wed, Nov 25, 2015 at 6:03 PM Timothy Gu <timothyg...@gmail.com> wrote: > >> On Wed, Nov 25, 2015 at 05:17:29PM -0500, Ganesh Ajjanagadde wrote: >> > + double f = value * cbrt_lut[value] * pow(2, (exponent - >> 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; >> >> While at it, you could change pow(2 to exp2(, which has a libm.h shim >> and is easily 4 times faster than pow() on my machine (glibc 2.19, >> Haswell). >> > > In light of the comments made by Ronald and James in the other thread, it > would probably be better if you look for instances of optimization > opportunities in other files that matter rather than these tablegen files > that will only be run once during the build process. A simple `git grep -E > 'powf?\(2'` shows an awful lot.
That is not true, the default configure line generates these at runtime (which was how I obtained the cycle numbers), translating to cycles burnt. The Arch Linux package I know for a fact does not build with "hardcoded tables". If it was just build time, I of course would not have bothered. Think of it this way: ~ 10^6 cycles is ~ 1 ms of running a CPU, and is part of trivially avoidable latency. Why it is still being done at runtime by default, I still don't understand why, and I requested for an email thread/explanation. I am working on all instances of pow, this was just one of them. For me, the answer is simple: any runtime savings on the order of 10^5 cycles (and above) is worth it unless it causes a huge loss of readability, even if it is in a init function that executes once. > > (BTW next time you send similar patches you c/should put them in a patch > series so that it's easier to track on the ML. I missed the other thread > before reading this one.) Will keep in mind; I sent these as I did them. > > Timtohy > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel