let profiler trace 'get member' calls, because I suspect they might be slow (linear string lookup)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1244 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-12-11 16:28:17 +00:00
parent 010c8d8d0b
commit dc2028a956
3 changed files with 28 additions and 0 deletions
+5
View File
@@ -11,6 +11,7 @@
#include <script/value.hpp>
#include <script/script.hpp>
#include <script/profiler.hpp>
#include <util/reflect.hpp>
#include <util/error.hpp>
#include <util/io/get_member.hpp>
@@ -269,6 +270,10 @@ class ScriptObject : public ScriptValue {
ScriptValueP d = getDefault(); return d ? d->toImage(d) : ScriptValue::toImage(thisP);
}
virtual ScriptValueP getMember(const String& name) const {
#if USE_SCRIPT_PROFILING
Timer t;
Profiler prof(t, _("get member"));
#endif
GetMember gm(name);
gm.handle(*value);
if (gm.result()) return gm.result();