start.p
| 1 |
define temp-table tt |
|---|---|
| 2 |
field words as character extent 5 |
| 3 |
field id as integer |
| 4 |
index word_idx is word-index words. |
| 5 |
|
| 6 |
create tt. |
| 7 |
assign tt.words[1] = "a | b | c" |
| 8 |
tt.words[2] = "d | e | f" |
| 9 |
tt.id = 1. |
| 10 |
release tt. |
| 11 |
|
| 12 |
create tt. |
| 13 |
assign tt.words[1] = "d | e | f" |
| 14 |
tt.words[2] = "a | b | c" |
| 15 |
tt.id = 1. |
| 16 |
release tt. |
| 17 |
|
| 18 |
create tt. |
| 19 |
assign tt.words[1] = "d | e | f" |
| 20 |
tt.words[2] = "a | b | c" |
| 21 |
tt.id = 1. |
| 22 |
release tt. |
| 23 |
|
| 24 |
create tt. |
| 25 |
assign tt.words[1] = "g | g | g" |
| 26 |
tt.words[2] = "g g g" |
| 27 |
tt.words[3] = "g g g" |
| 28 |
tt.words[4] = "g g g" |
| 29 |
tt.words[5] = "g g g" |
| 30 |
tt.id = 1. |
| 31 |
release tt. |
| 32 |
|
| 33 |
create tt. |
| 34 |
assign tt.words[1] = "g | g | g" |
| 35 |
tt.words[2] = "g g g" |
| 36 |
tt.words[3] = "g g g" |
| 37 |
tt.words[4] = "g g g" |
| 38 |
tt.words[5] = "g g g" |
| 39 |
tt.id = 1. |
| 40 |
release tt. |
| 41 |
|
| 42 |
def var i as int. |
| 43 |
def var l1 as int64. |
| 44 |
def var l2 as int64. |
| 45 |
def var k as int. |
| 46 |
|
| 47 |
k = 0. |
| 48 |
l1 = mtime. |
| 49 |
do i = 1 to 100000: |
| 50 |
for each tt where tt.words contains "d c": |
| 51 |
k = k + 1. |
| 52 |
end. |
| 53 |
end. |
| 54 |
l2 = mtime. |
| 55 |
|
| 56 |
message "Search: d" k "in" (l2 - l1) "ms". |
| 57 |
|
| 58 |
k = 0. |
| 59 |
l1 = mtime. |
| 60 |
do i = 1 to 100000: |
| 61 |
for each tt where tt.words contains "a c": |
| 62 |
k = k + 1. |
| 63 |
end. |
| 64 |
end. |
| 65 |
l2 = mtime. |
| 66 |
|
| 67 |
message "Search: a" k "in" (l2 - l1) "ms". |