http://gwt-code-reviews.appspot.com/1277801/diff/5001/6001
File plugins/npapi/NPVariantWrapper.h (right):
http://gwt-code-reviews.appspot.com/1277801/diff/5001/6001#newcode105
plugins/npapi/NPVariantWrapper.h:105: if (isInt(variant)) {
On 2011/01/12 00:43:50, fabiomfv wrote:
my concern with this is something I chatted with Jat a couple of weeks
ago. this
will be called many times over and may affect perf.
could we consider using modf() that is presumably optimized and it
would be a
one op to extract and check the integer part of a double.
i actually had a modf variant of this working locally, but I opted to
change it to this to err on the side of caution since modf is still
giving us a double that needs to be downcasted to an int and may be out
of int range.
just ran a quick test showing that adding modf into the mix slows things
down:
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
double d1 = 2141243;
int main(int c, char **argv) {
int count = 0;
int x = 0;
for (int i = 0; i < 100000000; i++) {
#ifdef MODF
double i;
if (modf(d1, &i) == 0.0) {
count++;
}
x = static_cast<int>(d1);
#else
x = static_cast<int>(d1);
if (d1 == static_cast<double>(x)) {
count++;
}
#endif
}
printf("done %d\n", count);
}
...
$ g++ -o modf -O0 modf.c && time ./modf
done 100000000
real 0m0.363s
user 0m0.354s
sys 0m0.004s
$ g++ -o modf -O0 -DMODF modf.c && time ./modf
done 100000000
real 0m1.273s
user 0m1.219s
sys 0m0.012s
http://gwt-code-reviews.appspot.com/1277801/diff/5001/6002
File plugins/npapi/main.cpp (right):
http://gwt-code-reviews.appspot.com/1277801/diff/5001/6002#newcode241
plugins/npapi/main.cpp:241: //Debug::log(Debug::Spam) <<
"NPP_HandleEvent(instance=" << instance << ")" << Debug::flush;
On 2011/01/12 00:43:50, fabiomfv wrote:
should this change be reverted?
as I said earlier, it gets called a ton on the Mac build and makes
debugging a pain. (while working on this I needed Spam level verbosity
to trace what was going on, but having this function fill up my terminal
buffer was not helpful)
http://gwt-code-reviews.appspot.com/1277801/show
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors