-
Notifications
You must be signed in to change notification settings - Fork 0
/
benmark.py
81 lines (78 loc) · 2.65 KB
/
benmark.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# _*_ coding: utf-8 _*_
from lib.store import insert, update, find, find_one, remove, add_file
import unittest
import random
from lib.utils import now
def insert_data():
for i in range(100000):
user = [ {
"userSeq": u,
"userId": "test",
"userName": "test"
} for u in range(random.randint(1, 1000))]
insert("TaskPlan",{
"className" : "com.c2vm.xia.rest.taskplan.bean.TaskPlan",
"taskSeq" : "4f90d10e0364dcca1c7ad26d",
"taskName" : "1",
"projSeq" : 43,
"projName" : "1",
"projIcon" : "",
"userId" : "",
"multiTask" : "T",
"taskSchedule" : "",
"markLoct" : "1",
"indexTag" : "",
"description" : "",
"corpSeq" : 17,
"crtDate" : "2012-04-20T02:59:26.996Z",
"crtUser" : 65,
"uptDate" : "2012-04-20T03:56:24.791Z",
"uptUser" : 65,
"uptStat" : "E",
"version" : 1,
"taskStatus" : "N",
"taskIconUrl" : "",
"userList" : user,
"entryList" : [
{
"className" : "com.c2vm.xia.viewcomponent.Camera",
"fieldType" : "Camera",
"comLabel" : "fasd",
"dataLabel" : "fasd",
"direction" : "up",
"url" : "/rest/service/resource/company/17/project/43/upload",
"size" : "854*480",
"layout" : "RL/UD",
"required" : False
},
{
"className" : "com.c2vm.xia.viewcomponent.Location",
"fieldType" : "Location",
"comLabel" : "dsa",
"name" : "111 ",
"latitude" : "",
"longitude" : "",
"layout" : "RL/UD",
"required" : False
}
]
})
def test_task_user_find():
print "start"
print now()
result = find("test_task", {"userList.userSeq": 5}, return_type="cusor")
print now()
#查询没问题
result = find("test_task", {"userList.userSeq": 5})
#取数据很慢非常慢
print "end"
print result
print result.count()
def test_insert():
print now()
for i in range(1000000):
insert("test",
{"test":1, "test2": "222xxxx", "test3":"kaonima", "test4": "qusiba"},
safe=False
)
print now()