forked from livecode/livecode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnative.livecodescript
More file actions
709 lines (623 loc) · 23.4 KB
/
Copy pathnative.livecodescript
File metadata and controls
709 lines (623 loc) · 23.4 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
script "StringsNative"
/*
Copyright (C) 2015 LiveCode Ltd.
This file is part of LiveCode.
LiveCode is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License v3 as published by the Free
Software Foundation.
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
local sLinesText, sItemsText, sCasedChunksText, sWords, sPartialWords
private command _SetupData
local tItemsText, tLinesText, tCasedChunkText
BenchmarkLoadNativeTextFile "dictionary.native.txt"
put the result into tLinesText
local tWord, tWords, tPartialWords, tInterval
put the number of lines of tLinesText div 10 into tInterval
repeat with i = 1 to 10
put line i * tInterval of tLinesText into tWord
if (i mod 2) is not 0 then
put toUpper(tWord) into tWord
end if
put tWord & tWord & tWord & tWord into tWords[i]
put char 5 to -5 of tWords[i] into tPartialWords[i]
put tWords[i] into line i * tInterval of tLinesText
end repeat
put tLinesText into tItemsText
replace return with comma in tItemsText
put tLinesText into tCasedChunkText
replace "a" with "z" in tCasedChunkText
replace return with "a" in tCasedChunkText
put tLinesText into sLinesText
put tItemsText into sItemsText
put tCasedChunkText into sCasedChunksText
put tPartialWords into sPartialWords
put tWords into sWords
end _SetupData
on BenchmarkOffset
_SetupData
local tLinesText, tWords
put sLinesText into tLinesText
put sWords into tWords
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tLinesTextToUse
if not the caseSensitive then
put toUpper(tLinesText) into tLinesTextToUse
else
put tLinesText into tLinesTextToUse
end if
BenchmarkStartTiming tMode
repeat 100 times
get offset(tWords[1], tLinesTextToUse)
get offset(tWords[2], tLinesTextToUse)
get offset(tWords[3], tLinesTextToUse)
get offset(tWords[4], tLinesTextToUse)
get offset(tWords[5], tLinesTextToUse)
get offset(tWords[6], tLinesTextToUse)
get offset(tWords[7], tLinesTextToUse)
get offset(tWords[8], tLinesTextToUse)
get offset(tWords[9], tLinesTextToUse)
get offset(tWords[10], tLinesTextToUse)
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkOffset
on BenchmarkContains
_SetupData
local tLinesText, tWords
put sLinesText into tLinesText
put sWords into tWords
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tLinesTextToUse
if not the caseSensitive then
put toUpper(tLinesText) into tLinesTextToUse
else
put tLinesText into tLinesTextToUse
end if
BenchmarkStartTiming tMode
repeat 100 times
get tLinesTextToUse contains tWords[1]
get tLinesTextToUse contains tWords[2]
get tLinesTextToUse contains tWords[3]
get tLinesTextToUse contains tWords[4]
get tLinesTextToUse contains tWords[5]
get tLinesTextToUse contains tWords[6]
get tLinesTextToUse contains tWords[7]
get tLinesTextToUse contains tWords[8]
get tLinesTextToUse contains tWords[9]
get tLinesTextToUse contains tWords[10]
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkContains
on BenchmarkContainsLargeNeedle
local tHaystack, tNeedle
put "FOOFbarbFOOFbarb" into tHaystack
repeat 16 times
put tHaystack after tHaystack
end repeat
put "1234" into char -4 to -1 of tHaystack
put char -1024 to -1 of tHaystack into tNeedle
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tHaystackToUse
if not the caseSensitive then
put toUpper(tHaystack) into tHaystackToUse
else
put tHaystack into tHaystackToUse
end if
BenchmarkStartTiming tMode
repeat 10 times
get tHaystackToUse contains tNeedle
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkContainsLargeNeedle
on BenchmarkBeginsWith
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tLinesText, tWords
put sLinesText into tLinesText
put sWords into tWords
local tPrefixes
repeat with i = 1 to 10
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put char 1 to (the number of chars in tWords[i] div 2) of tWords[i] into tPrefixes[i]
if not the caseSensitive then
put toLower(tWords[i]) into tWords[i]
put toUpper(tPrefixes[i]) into tPrefixes[i]
end if
end repeat
BenchmarkStartTiming tMode
repeat 1000 times
get tWords[1] begins with tPrefixes[1]
get tWords[2] begins with tPrefixes[2]
get tWords[3] begins with tPrefixes[3]
get tWords[4] begins with tPrefixes[4]
get tWords[5] begins with tPrefixes[5]
get tWords[6] begins with tPrefixes[6]
get tWords[7] begins with tPrefixes[7]
get tWords[8] begins with tPrefixes[8]
get tWords[9] begins with tPrefixes[9]
get tWords[10] begins with tPrefixes[10]
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkBeginsWith
on BenchmarkEndsWith
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tLinesText, tWords
put sLinesText into tLinesText
put sWords into tWords
local tSuffixes
repeat with i = 1 to 10
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put tWords[i] & tWords[i] & tWords[i] & tWords[i] & tWords[i] into tWords[i]
put char -(the number of chars in tWords[i] div 2) to -1 of tWords[i] into tSuffixes[i]
if not the caseSensitive then
put toLower(tWords[i]) into tWords[i]
put toUpper(tSuffixes[i]) into tSuffixes[i]
end if
end repeat
BenchmarkStartTiming tMode
repeat 1000 times
get tWords[1] ends with tSuffixes[1]
get tWords[2] ends with tSuffixes[2]
get tWords[3] ends with tSuffixes[3]
get tWords[4] ends with tSuffixes[4]
get tWords[5] ends with tSuffixes[5]
get tWords[6] ends with tSuffixes[6]
get tWords[7] ends with tSuffixes[7]
get tWords[8] ends with tSuffixes[8]
get tWords[9] ends with tSuffixes[9]
get tWords[10] ends with tSuffixes[10]
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkEndsWith
on BenchmarkDelimitedChunkOffsetWithSkip
_SetupData
repeat for each word tMode in "Exact Caseless"
local tSkip, tNumber
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tLinesText, tItemsText, tCasedChunksText
put sLinesText into tLinesText
put sItemsText into tItemsText
put sCasedChunksText into tCasedChunksText
if not the caseSensitive then
put toUpper(sLinesText) into tLinesText
put toUpper(sItemsText) into tItemsText
put toUpper(sCasedChunksText) into tCasedChunksText
end if
--------
set the lineDelimiter to return
put 0 into tSkip
BenchmarkStartTiming tMode && "Partial LineOffset With Skip"
repeat 5000 times
put lineOffset("th", tLinesText, tSkip) into tNumber
if tNumber is 0 then
exit repeat
end if
add tNumber to tSkip
end repeat
BenchmarkStopTiming
--------
set the itemDelimiter to comma
put 0 into tSkip
BenchmarkStartTiming tMode && "Partial ItemOffset With Skip"
repeat 5000 times
put itemOffset("th", tItemsText, tSkip) into tNumber
if tNumber is 0 then
exit repeat
end if
add tNumber to tSkip
end repeat
BenchmarkStopTiming
--------
set the itemDelimiter to "a"
put 0 into tSkip
BenchmarkStartTiming tMode && "Partial CasedChunkOffset With Skip"
repeat 5000 times
put itemOffset("th", tCasedChunksText, tSkip) into tNumber
if tNumber is 0 then
exit repeat
end if
add tNumber to tSkip
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkDelimitedChunkOffsetWithSkip
on BenchmarkDelimitedChunkOffset
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tPartialWords, tWords, tLinesText, tItemsText, tCasedChunksText
put sPartialWords into tPartialWords
put sWords into tWords
put sLinesText into tLinesText
put sItemsText into tItemsText
put sCasedChunksText into tCasedChunksText
set the wholeMatches to false
BenchmarkStartTiming tMode && "Partial LineOffset"
repeat 100 times
get lineOffset(tPartialWords[1], tLinesText)
get lineOffset(tPartialWords[2], tLinesText)
get lineOffset(tPartialWords[3], tLinesText)
get lineOffset(tPartialWords[4], tLinesText)
get lineOffset(tPartialWords[5], tLinesText)
get lineOffset(tPartialWords[6], tLinesText)
get lineOffset(tPartialWords[7], tLinesText)
get lineOffset(tPartialWords[8], tLinesText)
get lineOffset(tPartialWords[9], tLinesText)
get lineOffset(tPartialWords[10], tLinesText)
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to true
BenchmarkStartTiming tMode && "Whole LineOffset"
repeat 100 times
get lineOffset(tWords[1], tLinesText)
get lineOffset(tWords[2], tLinesText)
get lineOffset(tWords[3], tLinesText)
get lineOffset(tWords[4], tLinesText)
get lineOffset(tWords[5], tLinesText)
get lineOffset(tWords[6], tLinesText)
get lineOffset(tWords[7], tLinesText)
get lineOffset(tWords[8], tLinesText)
get lineOffset(tWords[9], tLinesText)
get lineOffset(tWords[10], tLinesText)
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to false
BenchmarkStartTiming tMode && "Partial ItemOffset"
repeat 100 times
get itemOffset(tPartialWords[1], tItemsText)
get itemOffset(tPartialWords[2], tItemsText)
get itemOffset(tPartialWords[3], tItemsText)
get itemOffset(tPartialWords[4], tItemsText)
get itemOffset(tPartialWords[5], tItemsText)
get itemOffset(tPartialWords[6], tItemsText)
get itemOffset(tPartialWords[7], tItemsText)
get itemOffset(tPartialWords[8], tItemsText)
get itemOffset(tPartialWords[9], tItemsText)
get itemOffset(tPartialWords[10], tItemsText)
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to true
BenchmarkStartTiming tMode && "Whole ItemOffset"
repeat 100 times
get itemOffset(tWords[1], tItemsText)
get itemOffset(tWords[2], tItemsText)
get itemOffset(tWords[3], tItemsText)
get itemOffset(tWords[4], tItemsText)
get itemOffset(tWords[5], tItemsText)
get itemOffset(tWords[6], tItemsText)
get itemOffset(tWords[7], tItemsText)
get itemOffset(tWords[8], tItemsText)
get itemOffset(tWords[9], tItemsText)
get itemOffset(tWords[10], tItemsText)
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to false
if the caseSensitive then
set the itemDelimiter to "a"
else
set the itemDelimiter to "A"
end if
BenchmarkStartTiming tMode && "Partial CasedChunkOffset"
repeat 100 times
get itemOffset(tPartialWords[1], tCasedChunksText)
get itemOffset(tPartialWords[2], tCasedChunksText)
get itemOffset(tPartialWords[3], tCasedChunksText)
get itemOffset(tPartialWords[4], tCasedChunksText)
get itemOffset(tPartialWords[5], tCasedChunksText)
get itemOffset(tPartialWords[6], tCasedChunksText)
get itemOffset(tPartialWords[7], tCasedChunksText)
get itemOffset(tPartialWords[8], tCasedChunksText)
get itemOffset(tPartialWords[9], tCasedChunksText)
get itemOffset(tPartialWords[10], tCasedChunksText)
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to true
if the caseSensitive then
set the itemDelimiter to "a"
else
set the itemDelimiter to "A"
end if
BenchmarkStartTiming tMode && "Whole CasedChunkOffset"
repeat 100 times
get itemOffset(tWords[1], tCasedChunksText)
get itemOffset(tWords[2], tCasedChunksText)
get itemOffset(tWords[3], tCasedChunksText)
get itemOffset(tWords[4], tCasedChunksText)
get itemOffset(tWords[5], tCasedChunksText)
get itemOffset(tWords[6], tCasedChunksText)
get itemOffset(tWords[7], tCasedChunksText)
get itemOffset(tWords[8], tCasedChunksText)
get itemOffset(tWords[9], tCasedChunksText)
get itemOffset(tWords[10], tCasedChunksText)
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkDelimitedChunkOffset
on BenchmarkDelimitedChunkAmong
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tPartialWords, tWords, tLinesText, tItemsText, tCasedChunksText
put sPartialWords into tPartialWords
put sWords into tWords
put sLinesText into tLinesText
put sItemsText into tItemsText
put sCasedChunksText into tCasedChunksText
--------
BenchmarkStartTiming tMode && "AmongTheLinesOf"
repeat 100 times
get tWords[1] is among the lines of tLinesText
get tWords[2] is among the lines of tLinesText
get tWords[3] is among the lines of tLinesText
get tWords[4] is among the lines of tLinesText
get tWords[5] is among the lines of tLinesText
get tWords[6] is among the lines of tLinesText
get tWords[7] is among the lines of tLinesText
get tWords[8] is among the lines of tLinesText
get tWords[9] is among the lines of tLinesText
get tWords[10] is among the lines of tLinesText
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to true
BenchmarkStartTiming tMode && "AmongTheItemsOf"
repeat 100 times
get tWords[1] is among the items of tItemsText
get tWords[2] is among the items of tItemsText
get tWords[3] is among the items of tItemsText
get tWords[4] is among the items of tItemsText
get tWords[5] is among the items of tItemsText
get tWords[6] is among the items of tItemsText
get tWords[7] is among the items of tItemsText
get tWords[8] is among the items of tItemsText
get tWords[9] is among the items of tItemsText
get tWords[10] is among the items of tItemsText
end repeat
BenchmarkStopTiming
--------
set the wholeMatches to true
if the caseSensitive then
set the itemDelimiter to "a"
else
set the itemDelimiter to "A"
end if
BenchmarkStartTiming tMode && "AmongTheCasedChunksOf"
repeat 100 times
get tWords[1] is among the items of tCasedChunksText
get tWords[2] is among the items of tCasedChunksText
get tWords[3] is among the items of tCasedChunksText
get tWords[4] is among the items of tCasedChunksText
get tWords[5] is among the items of tCasedChunksText
get tWords[6] is among the items of tCasedChunksText
get tWords[7] is among the items of tCasedChunksText
get tWords[8] is among the items of tCasedChunksText
get tWords[9] is among the items of tCasedChunksText
get tWords[10] is among the items of tCasedChunksText
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkDelimitedChunkAmong
on BenchmarkDelimitedChunkOf
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tPartialWords, tWords, tLinesText, tItemsText, tCasedChunksText
put sPartialWords into tPartialWords
put sWords into tWords
put sLinesText into tLinesText
put sItemsText into tItemsText
put sCasedChunksText into tCasedChunksText
BenchmarkStartTiming tMode && "LineOf"
repeat 10000 times
get line 10 of tLinesText
get line 100 of tLinesText
get line 1000 of tLinesText
get line 10000 of tLinesText
end repeat
BenchmarkStopTiming
BenchmarkStartTiming tMode && "ItemOf"
repeat 10000 times
get item 10 of tItemsText
get item 100 of tItemsText
get item 1000 of tItemsText
get item 10000 of tItemsText
end repeat
BenchmarkStopTiming
if the caseSensitive then
set the itemDelimiter to "a"
else
set the itemDelimiter to "A"
end if
BenchmarkStartTiming tMode && "CasedChunkOf"
repeat 10000 times
get item 10 of tCasedChunksText
get item 100 of tCasedChunksText
get item 1000 of tCasedChunksText
get item 10000 of tCasedChunksText
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkDelimitedChunkOf
on BenchmarkDelimitedChunkRangeOf
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tPartialWords, tWords, tLinesText, tItemsText, tCasedChunksText
put sPartialWords into tPartialWords
put sWords into tWords
put sLinesText into tLinesText
put sItemsText into tItemsText
put sCasedChunksText into tCasedChunksText
BenchmarkStartTiming tMode && "LineRangeOf"
repeat 10000 times
get line 1 to 10 of tLinesText
get line 10 to 100 of tLinesText
get line 100 to 1000 of tLinesText
get line 1000 to 10000 of tLinesText
end repeat
BenchmarkStopTiming
BenchmarkStartTiming tMode && "ItemRangeOf"
repeat 10000 times
get item 1 to 10 of tItemsText
get item 10 to 100 of tItemsText
get item 100 to 1000 of tItemsText
get item 1000 to 10000 of tItemsText
end repeat
BenchmarkStopTiming
if the caseSensitive then
set the itemDelimiter to "a"
else
set the itemDelimiter to "A"
end if
BenchmarkStartTiming tMode && "CasedChunkRangeOf"
repeat 10000 times
get item 1 to 10 of tCasedChunksText
get item 10 to 100 of tCasedChunksText
get item 100 to 1000 of tCasedChunksText
get item 1000 to 10000 of tCasedChunksText
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkDelimitedChunkRangeOf
on BenchmarkDelimitedReverseChunkOf
_SetupData
repeat for each word tMode in "Exact Caseless"
if tMode is "Exact" then
set the caseSensitive to true
else
set the caseSensitive to false
end if
local tPartialWords, tWords, tLinesText, tItemsText, tCasedChunksText
put sPartialWords into tPartialWords
put sWords into tWords
put sLinesText into tLinesText
put sItemsText into tItemsText
put sCasedChunksText into tCasedChunksText
BenchmarkStartTiming tMode && "ReverseLineOf"
repeat 100 times
get line -10 of tLinesText
get line -100 of tLinesText
get line -1000 of tLinesText
get line -10000 of tLinesText
end repeat
BenchmarkStopTiming
BenchmarkStartTiming tMode && "ReverseItemOf"
repeat 100 times
get item -10 of tItemsText
get item -100 of tItemsText
get item -1000 of tItemsText
get item -10000 of tItemsText
end repeat
BenchmarkStopTiming
if the caseSensitive then
set the itemDelimiter to "a"
else
set the itemDelimiter to "A"
end if
BenchmarkStartTiming tMode && "ReverseCasedChunkOf"
repeat 100 times
get item -10 of tCasedChunksText
get item -100 of tCasedChunksText
get item -1000 of tCasedChunksText
get item -10000 of tCasedChunksText
end repeat
BenchmarkStopTiming
end repeat
end BenchmarkDelimitedReverseChunkOf
on BenchmarkBoundaryChunkOf
_SetupData
local tCasedChunksText
put sCasedChunksText into tCasedChunksText
BenchmarkStartTiming "CharOf"
repeat 100000 times
get char 1 of tCasedChunksText
get char 10 of tCasedChunksText
get char 100 of tCasedChunksText
get char 1000 of tCasedChunksText
get char 10000 of tCasedChunksText
end repeat
BenchmarkStopTiming
end BenchmarkBoundaryChunkOf
on BenchmarkBoundaryRangeChunkOf
_SetupData
local tCasedChunksText
put sCasedChunksText into tCasedChunksText
BenchmarkStartTiming "CharRangeOf"
repeat 100000 times
get char 1 to 10 of tCasedChunksText
get char 10 to 100 of tCasedChunksText
get char 100 to 1000 of tCasedChunksText
get char 1000 to 10000 of tCasedChunksText
get char 10000 to 100000 of tCasedChunksText
end repeat
BenchmarkStopTiming
end BenchmarkBoundaryRangeChunkOf