commit 6e064bb4ce97bc7ad9f7b0cff6797db107a79cc5 parent c0c5695bf26897c525fa723e1126819a9c05707e Author: Simon Kornblith <simon@simonster.com> Date: Tue, 24 Jul 2012 02:59:21 -0400 Avoid excessive calls to XPCWrappedNative::GetWrappedNativeOfJSObject when determining field type Diffstat:
| M | chrome/content/zotero/xpcom/db.js | | | 11 | ++++++----- |
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js @@ -1244,16 +1244,17 @@ Zotero.DBConnection.prototype._debug = function (str, level) { Zotero.DBConnection.prototype._getTypedValue = function (statement, i) { var type = statement.getTypeOfIndex(i); + // For performance, we hard-code these constants switch (type) { - case statement.VALUE_TYPE_INTEGER: + case 1: //VALUE_TYPE_INTEGER return statement.getInt64(i); - case statement.VALUE_TYPE_TEXT: + case 3: //VALUE_TYPE_TEXT return statement.getUTF8String(i); - case statement.VALUE_TYPE_NULL: + case 0: //VALUE_TYPE_NULL return null; - case statement.VALUE_TYPE_FLOAT: + case 2: //VALUE_TYPE_FLOAT return statement.getDouble(i); - case statement.VALUE_TYPE_BLOB: + case 4: //VALUE_TYPE_BLOB return statement.getBlob(i, {}); } }