<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
+ <file url="file://$PROJECT_DIR$/node" libraries="{EcmaScript, Node.js Embedded Symbols, Node.js v0.10.5 Core Library}" />
<excludedPredefinedLibrary name="AJAX" />
<excludedPredefinedLibrary name="DHTML" />
<excludedPredefinedLibrary name="DOM Core" />
<excludedPredefinedLibrary name="DOM Events" />
<excludedPredefinedLibrary name="DOM Traversal And Range" />
<excludedPredefinedLibrary name="DOM XPath" />
+ <excludedPredefinedLibrary name="EcmaScript" />
+ <excludedPredefinedLibrary name="EcmaScript Additional" />
+ <excludedPredefinedLibrary name="EcmaScript L5" />
<excludedPredefinedLibrary name="EcmaScript for XML" />
<excludedPredefinedLibrary name="HTML 5" />
+ <excludedPredefinedLibrary name="Node.js Embedded Symbols" />
<excludedPredefinedLibrary name="WebGL" />
</component>
</project>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="lib" level="project" />
+ <orderEntry type="library" name="Node.js v0.10.5 Core Library" level="application" />
</component>
</module>
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Kahlua" jdkType="Lua SDK" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Node.js v0.10.5 Core Library" level="application" />
</component>
</module>
<toolsSet>
<remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
<compilerSet>default</compilerSet>
+ <dependencyChecking>false</dependencyChecking>
+ <rebuildPropChanged>false</rebuildPropChanged>
</toolsSet>
<codeAssistance>
</codeAssistance>
--- /dev/null
+//var crypto = require("crypto");
+
+if (typeof module != "undefined") {
+ module.exports.randomFloat = randomFloat;
+ module.exports.randomInt32 = randomInt32;
+ module.exports.randomString = randomString;
+ module.exports.randomStringArr = randomStringArr;
+ module.exports.randomIntArr = randomIntArr;
+ module.exports.randomField = randomField;
+}
+
+function randomFloat(min, max) {
+ if (min == null || max == null) {
+ //return crypto.randomBytes(64).readDoubleLE(0);
+ return 2147483647 * Math.random() - 2147483647 * Math.random();
+ } else {
+ return Math.random() * (max - min) + min;
+ }
+}
+
+function randomInt32(min, max) {
+ if (min == null || max == 0) {
+ //return crypto.randomBytes(32).readInt32LE(0);
+ return Math.ceil(2147483647 * Math.random()) - Math.ceil(2147483647 * Math.random());
+ } else {
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+ }
+}
+
+function randomIntArr(maxarrlen, min, max) {
+ var arr = new Array(maxarrlen);
+ for (var i = 0; i < maxarrlen; ++i) {
+ arr[i] = randomInt32(min, max);
+ }
+ return arr;
+}
+
+function randomStringArr(maxarrlen, maxstrlen) {
+ var arr = new Array(maxarrlen);
+ for (var i = 0; i < maxarrlen; ++i) {
+ arr[i] = randomString(randomInt32(1, maxstrlen));
+ }
+ return arr;
+}
+
+function randomString(maxlen) {
+ maxlen = (maxlen != null) ? maxlen : 256;
+ var carr = new Buffer(maxlen);
+ for (var i = 0; i < maxlen; ++i) {
+ carr[i] = (0x21 + Math.floor(Math.random() * (0x7e - 0x21 + 1)));
+ }
+ return carr.toString("ascii");
+}
+
+
+function randomField() {
+ var maxlen = randomInt32(1, 48);
+ var carr = new Buffer(maxlen);
+ for (var i = 0; i < maxlen; ++i) {
+ carr[i] = (0x61 + Math.floor(Math.random() * (0x7a - 0x61 + 1)));
+ }
+ return carr.toString("ascii");
+}
--- /dev/null
+var butils = require("../benchutils.js");
+var EJDB = require("ejdb");
+var jb = EJDB.open("bench1", EJDB.DEFAULT_OPEN_MODE | EJDB.JBOTRUNC);
+
+
+function run(opts, prepareCb, saveCb) {
+ var rows = opts["rows"]; //max number of rows for each iteration
+ var queries = opts["queries"]; //max number of queries
+ if (rows == null || isNaN(rows)) {
+ throw new Error("Missing required 'rows' option");
+ }
+ if (queries == null || isNaN(queries)) {
+ throw new Error("Missing required 'queries' option");
+ }
+ if (queries > rows) {
+ queries = rows;
+ }
+ var maxfields = opts["maxfields"] || 10; //max number of fields on each object nesting level
+ var maxlevels = opts["maxlevels"] || 3; //max number of nested object levels
+ var lvlindexedfields = opts["lvlindexedfields"] != null ? opts["lvlindexedfields"] : 2; //max number of indexed field for each level
+
+ var qfields = {};
+ var types = ["s", "i", "f", "a", "ia", "o"];
+ var parents = [];
+ parents[0] = {};
+ for (var l = 0; l < maxlevels; ++l) {
+ var inum = lvlindexedfields;
+ for (var f = 0; f < maxfields; ++f) {
+ var fname = butils.randomField(32);
+ var fo = {
+ "_t" : types[butils.randomInt32(0, types.length - 1)]
+ };
+ if (fo._t !== "o" && inum > 0) {
+ fo._i = true; //field indexed
+ --inum;
+ }
+ if (fo._t === "o") {
+ parents[l + 1] = fo;
+ }
+ if (parents[l]) {
+ parents[l][fname] = fo;
+ }
+ }
+ }
+ function constructObj(meta, out, fstack, qinc) {
+ if (fstack == null) {
+ fstack = [];
+ }
+ for (var k in meta) {
+ if (k[0] === "_" || typeof meta[k] !== "object") {
+ continue;
+ }
+ fstack.push(k);
+ var fo = meta[k];
+ switch (fo._t) {
+ case "s":
+ out[k] = butils.randomString(butils.randomInt32(1, 256));
+ break;
+ case "a":
+ out[k] = butils.randomStringArr(butils.randomInt32(1, 64), 128);
+ break;
+ case "i":
+ out[k] = butils.randomInt32();
+ break;
+ case "f":
+ out[k] = butils.randomFloat();
+ break;
+ case "ia":
+ out[k] = butils.randomIntArr(butils.randomInt32(1, 64));
+ break;
+ case "o":
+ out[k] = constructObj(fo, {}, fstack, qinc);
+ break;
+ }
+ if (fo._t !== "o") {
+ var fname = fstack.join(".");
+ if (qfields[fname] == null) {
+ qfields[fname] = {_i : !!fo._i, _t : fo._t, _v : []};
+ }
+ if (qinc) {
+ qfields[fname]._v.push(out[k]);
+ }
+ }
+ fstack.pop();
+ }
+ return out;
+ }
+
+ var util = require("util");
+ var st = +new Date();
+
+
+ constructObj(parents[0], {}, [], false); //populate qfields
+ prepareCb(opts, qfields);
+
+ var qratio = Math.ceil(rows / queries);
+ for (var r = 0; r < rows; ++r) {
+ var isq = ((r % qratio) == 0);
+ var obj = constructObj(parents[0], {}, [], isq);
+ saveCb(opts, obj);
+ }
+
+
+ return +new Date() - st;
+}
+
+var time = run({
+ cname : "run1",
+ rows : 100000,
+ queries : 1000,
+ maxfields : 10,
+ maxlevels : 3,
+ lvlindexedfields : 2
+ }, function(opts, qfields) {
+ jb.ensureCollection(opts.cname, {records : opts.rows, large : true});
+ for (var k in qfields) {
+ var qf = qfields[k];
+ if (!qf._i) continue;
+ switch (qf._t) {
+ case "i":
+ case "f":
+ jb.ensureNumberIndex(opts.cname, k);
+ break;
+ case "s":
+ jb.ensureStringIndex(opts.cname, k);
+ break;
+ case "a":
+ case "ia":
+ jb.ensureArrayIndex(opts.cname, k);
+ }
+ }
+ },
+ function(opts, obj) {
+ jb.save(opts.cname, obj);
+ });
+
+console.log("run1 time=%d", time);
+
+//cleanup
+if (false) {
+ var c = 0;
+ jb.getDBMeta()["collections"].forEach(function(co) {
+ console.log("Drop collection %s", co.name);
+ ++c;
+ jb.dropCollection(co.name, true, function() {
+ --c;
+ if (c == 0) {
+ jb.close();
+ }
+
+ });
+ });
+} else {
+ jb.close();
+}
+
+
{
"name" : "ejdb",
- "version" : "1.1.3-4",
+ "version" : "1.1.4-4",
"config" : {
"windownloadurl_ia32" : "http://dl.dropboxusercontent.com/u/4709222/ejdb/tcejdb-1.1.3-mingw32-i686.zip",
"windownloadurl_x64" : "http://dl.dropboxusercontent.com/u/4709222/ejdb/tcejdb-1.1.3-mingw32-x86_64.zip"
<toolsSet>
<remote-sources-mode>LOCAL_SOURCES</remote-sources-mode>
<compilerSet>default</compilerSet>
+ <dependencyChecking>false</dependencyChecking>
+ <rebuildPropChanged>false</rebuildPropChanged>
</toolsSet>
<codeAssistance>
</codeAssistance>
</content>
<orderEntry type="jdk" jdkName="Python 3.2.3 (/usr/bin/python3mu)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Node.js v0.10.5 Core Library" level="application" />
</component>
</module>
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tcejdb 1.1.3.
+# Generated by GNU Autoconf 2.69 for tcejdb 1.1.4.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
# Identity of this package.
PACKAGE_NAME='tcejdb'
PACKAGE_TARNAME='tcejdb'
-PACKAGE_VERSION='1.1.3'
-PACKAGE_STRING='tcejdb 1.1.3'
+PACKAGE_VERSION='1.1.4'
+PACKAGE_STRING='tcejdb 1.1.4'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tcejdb 1.1.3 to adapt to many kinds of systems.
+\`configure' configures tcejdb 1.1.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tcejdb 1.1.3:";;
+ short | recursive ) echo "Configuration of tcejdb 1.1.4:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tcejdb configure 1.1.3
+tcejdb configure 1.1.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tcejdb $as_me 1.1.3, which was
+It was created by tcejdb $as_me 1.1.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tcejdb $as_me 1.1.3, which was
+This file was extended by tcejdb $as_me 1.1.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-tcejdb config.status 1.1.3
+tcejdb config.status 1.1.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
test -n "$LDFLAGS" && MYLDFLAGS="$LDFLAGS $MYLDFLAGS"
# Package name
-AC_INIT(tcejdb, 1.1.3)
+AC_INIT(tcejdb, 1.1.4)
AC_CANONICAL_HOST
# Package information
+libtcejdb (1.1.4-0) testing; urgency=low
+
+ * Array token index can be used for number eq matching
+
+ -- Anton Adamansky <adamansky@gmail.com> Sun, 05 May 2013 22:11:14 +0700
+
libtcejdb (1.1.3-0) testing; urgency=low
* Minor optimizations in the header files
case TDBQCSTRRX:
{
_FETCHSTRFVAL();
- rv = qf->regex && (regexec((regex_t *)qf->regex, fval, 0, NULL, 0) == 0);
+ rv = qf->regex && (regexec((regex_t *) qf->regex, fval, 0, NULL, 0) == 0);
break;
}
case TDBQCNUMEQ:
//No direct operation index. Any alternatives?
if (idxmeta &&
!(qf->flags & EJCONDICASE) && //if not case insensitive query
- (qf->tcop == TDBQCSTREQ || qf->tcop == TDBQCSTROREQ || qf->tcop == TDBQCNUMOREQ)) {
+ (
+ qf->tcop == TDBQCSTREQ ||
+ qf->tcop == TDBQCSTROREQ ||
+ qf->tcop == TDBQCNUMOREQ ||
+ qf->tcop == TDBQCNUMEQ)
+ ) {
bson_iterator it;
bson_type bt = bson_find(&it, idxmeta, "iflags");
if (bt != BSON_INT) {
qf->expr = tclistdump(qf->exprlist, &qf->exprsz);
qf->ftype = BSON_ARRAY;
return idx;
+ } else if (qf->tcop == TDBQCNUMEQ) {
+ qf->tcop = TDBQCSTRNUMOR;
+ qf->exprlist = tclistnew2(1);
+ TCLISTPUSH(qf->exprlist, qf->expr, qf->exprsz);
+ if (qf->expr) TCFREE(qf->expr);
+ qf->expr = tclistdump(qf->exprlist, &qf->exprsz);
+ qf->ftype = BSON_ARRAY;
+ return idx;
} else if (qf->tcop == TDBQCSTROREQ) {
assert(qf->ftype == BSON_ARRAY);
qf->tcop = TDBQCSTROR;
<configurationDescriptor version="88">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="." name="tcejdb">
- <df name="bros">
- <in>bdbtest.c</in>
- <in>cdbtest.c</in>
- <in>cmpsqltctest.c</in>
- <in>gdbmtest.c</in>
- <in>maptest.cc</in>
- <in>ndbmtest.c</in>
- <in>qdbmtest.c</in>
- <in>sdbmtest.c</in>
- <in>sqltest.c</in>
- <in>tctest.c</in>
- <in>tdbtest.c</in>
- </df>
<df name="nix">
<in>platform.h</in>
</df>
<buildCommandWorkingDir>.</buildCommandWorkingDir>
<buildCommand>${MAKE} -f Makefile</buildCommand>
<cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
- <executablePath>tcfmttest</executablePath>
+ <executablePath>testejdb/t4</executablePath>
<cTool>
<preprocessorList>
<Elem>_GNU_SOURCE=1</Elem>
</makefileType>
<item path="basedefs.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="bros/bdbtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/cdbtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/cmpsqltctest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/gdbmtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/maptest.cc" ex="false" tool="1" flavor2="4">
- <ccTool>
- </ccTool>
- </item>
- <item path="bros/ndbmtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/qdbmtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/sdbmtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/sqltest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/tctest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
- <item path="bros/tdbtest.c" ex="false" tool="0" flavor2="2">
- <cTool>
- </cTool>
- </item>
<item path="bson.c" ex="false" tool="0" flavor2="2">
<cTool>
<incDir>
</item>
<item path="encoding.h" ex="false" tool="3" flavor2="0">
</item>
- <folder path="tcejdb/bros">
- <cTool>
- <incDir>
- <pElem>../../../../include</pElem>
- <pElem>.</pElem>
- <pElem>/usr/local/include</pElem>
- </incDir>
- </cTool>
- </folder>
<folder path="tcejdb/samples">
<cTool>
<incDir>
</makefileType>
<item path="basedefs.h" ex="false" tool="3" flavor2="0">
</item>
- <item path="bros/bdbtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/cdbtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/cmpsqltctest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/gdbmtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/maptest.cc" ex="false" tool="1" flavor2="0">
- <ccTool>
- </ccTool>
- </item>
- <item path="bros/ndbmtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/qdbmtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/sdbmtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/sqltest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/tctest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
- <item path="bros/tdbtest.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
- </item>
<item path="bson.c" ex="false" tool="0" flavor2="0">
<cTool>
<incDir>
</item>
<item path="encoding.h" ex="false" tool="3" flavor2="0">
</item>
- <folder path="tcejdb/bros">
- <cTool>
- <incDir>
- <pElem>../../../../include</pElem>
- <pElem>.</pElem>
- <pElem>/usr/local/include</pElem>
- </incDir>
- </cTool>
- </folder>
<folder path="tcejdb/samples">
<cTool>
<incDir>
</cTool>
</item>
<item path="samples/sample1/sample1.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
</item>
<item path="tcadb.c" ex="false" tool="0" flavor2="0">
<cTool>
<item path="tcutil.h" ex="false" tool="3" flavor2="0">
</item>
<item path="testejdb/t1.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
</item>
<item path="testejdb/t2.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
</item>
<item path="testejdb/t3.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
</item>
<item path="testejdb/t4.c" ex="false" tool="0" flavor2="0">
- <cTool>
- </cTool>
</item>
<item path="utf8proc.c" ex="false" tool="0" flavor2="0">
<cTool>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>tcejdb</name>
<c-extensions>c</c-extensions>
- <cpp-extensions>cc,cpp</cpp-extensions>
+ <cpp-extensions>cpp</cpp-extensions>
<header-extensions>h</header-extensions>
<sourceEncoding>UTF-8</sourceEncoding>
<make-dep-projects/>
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/nbproject" />
</content>
- <content url="file://$USER_HOME$/tmp/tokyocabinet-win" />
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Node.js v0.10.5 Core Library" level="application" />
</component>
</module>