-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.php
57 lines (45 loc) · 1.34 KB
/
index.php
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
<?php
require_once(__DIR__.'/../../../Autoloader.php');
require_once(__DIR__.'/../../function.php');
use MDword\WordProcessor;
ini_set('memory_limit','1600M');
set_time_limit(1200);
$ns = [
100,
500,
1000,
10000,
// 50000
];
$markdownTableDatas = [["测试项","用时(S)"]];
$template = __DIR__.'/temple.docx';
$rtemplate = __DIR__.'/r-temple.docx';
foreach($ns as $n) {
$TemplateProcessor = new WordProcessor();
$TemplateProcessor->load($template);
$b = microtime(true);
$TemplateProcessor->clones("test",$n);
$datas = [];
for($i = 0;$i<$n;$i++) {
$TemplateProcessor->setValue('test#'.$i, $text);
}
$TemplateProcessor->saveAs($rtemplate);
$e = microtime(true);
$markdownTableDatas[] = ["1页母版赋值".$n."次",number_format($e-$b,2)];
}
$template = __DIR__.'/1750pages.docx';
$rtemplate = __DIR__.'/r-1750pages.docx';
foreach($ns as $n) {
$b = microtime(true);
$TemplateProcessor = new WordProcessor();
$TemplateProcessor->load($template);
$TemplateProcessor->cloneP('test', $n);
for($i=0;$i<$n;$i++) {
$TemplateProcessor->setValue('test#'.$i, 'MDword'.$i);
}
$TemplateProcessor->saveAs($rtemplate);
$e = microtime(true);
$markdownTableDatas[] = ["1750页母版赋值".$n."次",number_format($e-$b,2)];
}
echo markdownTable($markdownTableDatas);
return ;