Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3aa75d5

Browse files
committed
IMP remove dom indices
IMP inherit cache from factory
1 parente1ca662 commit3aa75d5

26 files changed

+1269
-1176
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
##0.7.4
2-
`improve`improve cachehandler which gains overall performance up to 20%<br>
2+
`improve`inherit cachefrom factory<br>
33
`improve` add fast path within reconciliation<br>
4+
`improve` indices requires no sync anymore<br>
5+
`change` remove dom indices, method access by index is now recommended (access by node is still supported but has extra costs, prevent looping via method access by node)<br>
6+
`new` method___dispatch___ to call/invoke an event handler manually<br>
47
`fix` external/internal stores<br>
58

69
##0.7.3

‎README.md‎

Lines changed: 99 additions & 39 deletions
Large diffs are not rendered by default.

‎bench/README.md‎

Lines changed: 252 additions & 250 deletions
Large diffs are not rendered by default.

‎bench/bench.js‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if(params["duration"] && (params["duration"].indexOf("run-") !== -1)){
5555
}
5656
else{
5757

58-
duration=parseFloat(params["duration"]||"3")*1000;
58+
duration=parseFloat(params["duration"]||"5")*1000;
5959
}
6060

6161
consthidden=params["hidden"]!=="false";
@@ -391,7 +391,7 @@ window.onload = function(){
391391
item.test||(item.test=suite[lib]);
392392
}
393393

394-
setTimeout(perform,500);
394+
setTimeout(perform,200);
395395
}
396396
};
397397

@@ -554,7 +554,7 @@ function perform(){
554554
status=false;
555555
}
556556

557-
letloops=0,now=perf.now();
557+
letloops=0,now=0;
558558

559559
if(status){
560560

@@ -567,10 +567,15 @@ function perform(){
567567
// return;
568568
// }
569569

570-
constend=now+duration;
570+
constend=perf.now()+duration;
571571

572572
for(letstart,mem_start,mem;now<end;loops++){
573573

574+
if(runs&&(runs===loops)){
575+
576+
break;
577+
}
578+
574579
if(test.start)test.start(loops);
575580
if(!internal&&test.prepare)test.prepare(loops);
576581

@@ -580,15 +585,10 @@ function perform(){
580585
test.fn(clone);
581586
now=perf.now();
582587
mem=perf.memory.usedJSHeapSize-mem_start;
583-
elapsed+=now-start;
588+
elapsed+=(now-start);
584589
if(mem>0)memory+=mem;
585590

586591
if(test.end)test.end(loops);
587-
588-
if(runs&&(runs===loops+1)){
589-
590-
break;
591-
}
592592
}
593593

594594
if(test.complete)test.complete();
@@ -602,16 +602,16 @@ function perform(){
602602

603603
if(window===window.top){
604604

605-
result.nodeValue=(str_results+=(status ?test.name.padEnd(12)+String(Math.floor(1000/elapsed*loops)).padStart(8)+" op/s, Memory:\t"+(memory ?Math.floor(memory/loops) :"-") :"- failed -")+"\n")+(current<queue.length ?"running..." :"");
605+
result.nodeValue=(str_results+=(status ?test.name.padEnd(12)+String(Math.floor(1000/elapsed*loops)).padStart(8)+" op/s, Memory:\t"+(memory ?Math.ceil(memory/loops) :"-") :"- failed -")+"\n")+(current<queue.length ?"running..." :"");
606606
}
607607
else{
608608

609-
window.top.postMessage(test.name+","+(status ?Math.floor(1000/elapsed*loops) :0)+","+(status ?Math.floor(memory/loops) :0),location.protocol+"//"+location.hostname)//"https://nextapps-de.github.io" "https://raw.githack.com"
609+
window.top.postMessage(test.name+","+(status ?Math.floor(1000/elapsed*loops) :0)+","+(status ?Math.ceil(memory/loops) :0),location.protocol+"//"+location.hostname)//"https://nextapps-de.github.io" "https://raw.githack.com"
610610
}
611611

612612
if(current<queue.length){
613613

614-
setTimeout(perform,500);
614+
setTimeout(perform,200);
615615
}
616616
else{
617617

‎bench/index.html‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h1>Benchmark of Web Templating Engines (Stress Test)</h1>
3333
<table>
3434
<tr>
3535
<td>
36-
<inputtype="button"click="start"value="Start">
36+
<inputtype="button"id="start"click="start"value="Start">
3737
</td>
3838
<td>&emsp;</td>
3939
<td>
@@ -48,29 +48,30 @@ <h1>Benchmark of Web Templating Engines (Stress Test)</h1>
4848
<td>
4949
Duration:
5050
<selectid="duration">
51+
<!--
5152
<optgroup label="run">
52-
<optionvalue="run-2">2 runs</option>
53-
<optionvalue="run-5">5 runs</option>
54-
<optionvalue="run-10">10 runs</option>
5553
<option value="run-50">50 runs</option>
5654
<option value="run-100">100 runs</option>
55+
<option value="run-250">250 runs</option>
56+
<option value="run-500">500 runs</option>
5757
<option value="run-1000">1000 runs</option>
5858
</optgroup>
5959
<optgroup label="time">
60+
-->
6061
<optionvalue="0.1">100 ms</option>
6162
<optionvalue="0.5">500 ms</option>
6263
<optionvalue="1">1 sec</option>
63-
<optionvalue="3"selected>3 sec</option>
64-
<optionvalue="5">5 sec</option>
64+
<optionvalue="3">3 sec</option>
65+
<optionvalue="5"selected>5 sec</option>
6566
<optionvalue="10">10 sec</option>
6667
<optionvalue="30">30 sec</option>
67-
</optgroup>
68+
<!--</optgroup>-->
6869
</select>
6970
</td>
7071
<td>&emsp;</td>
7172
<td>
7273
Repeat:
73-
<selectchange="repeat">
74+
<selectid="repeat">
7475
<optionvalue="1"selected>1</option>
7576
<optionvalue="2">2</option>
7677
<optionvalue="5">5</option>
@@ -82,7 +83,7 @@ <h1>Benchmark of Web Templating Engines (Stress Test)</h1>
8283
</td>
8384
<td>&emsp;</td>
8485
<td>
85-
<inputtype="checkbox"id="best"checkeddisabled> keep best run
86+
<inputtype="checkbox"id="keep"checked> keep best run
8687
</td>
8788
</tr>
8889
</table>

‎bench/main.js‎

Lines changed: 66 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
constmikado=Mikado(document.getElementById("result"),"row",options);
88
constlist=Mikado(document.getElementById("lib"),"lib",options);
99

10+
constmodes=window.location.hash.indexOf("modes")!==-1;
1011
letstrict;
11-
letmodes=window.location.hash.indexOf("modes")!==-1;
1212
letinternal;
1313
letkeyed;
14+
letkeep;
15+
letrepeat;
16+
letindex=-1;
1417

15-
constlib=shuffle(modes ?[
18+
letlib=shuffle(modes ?[
1619

1720
"mikado-cross-shared","mikado-exclusive","mikado-keyed",
1821
"mikado-keyed-shared","mikado-non-keyed","mikado-proxy",
@@ -42,8 +45,6 @@
4245

4346
init(window.location.hash);
4447

45-
letindex=-1;
46-
4748
document.getElementById("mode").options[keyed ?1 :internal ?2 :0].selected=true;
4849

4950
if(modes){
@@ -56,8 +57,9 @@
5657
if(target.value==="Start"){
5758

5859
index=-1;
60+
repeat=document.getElementById("repeat").value;
5961
target.value="Stop";
60-
setTimeout(runner,100);
62+
setTimeout(runner,200);
6163
}
6264
else{
6365

@@ -81,7 +83,7 @@
8183
"remove","toggle","clear"
8284
];
8385

84-
letcurrent=newArray(lib.length);
86+
constcurrent=newArray(lib.length);
8587

8688
letsize={
8789

@@ -131,10 +133,12 @@
131133
functionrunner(){
132134

133135
constduration=document.getElementById("duration").value;
136+
keep=document.getElementById("keep").checked;
134137

135138
index++;
136-
current[index][test[2]]="run...";
137-
mikado.update(mikado.node(index),current[index]);
139+
consttmp=Object.assign({},current[index]);
140+
tmp[test[2]]="run...";
141+
mikado.update(mikado.node(index),tmp);
138142
iframe.src="test/"+lib[index].toLowerCase()+"/"+(keyed ?"keyed.html" :strict ?"strict.html" :internal ?"internal.html" :"")+("?duration="+duration);
139143
}
140144

@@ -239,12 +243,43 @@
239243

240244
if(event.origin===location.protocol+"//"+location.hostname){// "https://nextapps-de.github.io" "https://raw.githack.com"
241245

246+
//console.log(event.data);
247+
242248
constparts=event.data.split(",");
243249

244-
current[index][parts[0]]=parseInt(parts[1],10);
245-
current[index]["memory"]+=parseInt(parts[2],10);
250+
lettmp=parseInt(parts[1],10);
251+
252+
if(keep){
253+
254+
if(!current[index][parts[0]]||(tmp>current[index][parts[0]])){
255+
256+
current[index][parts[0]]=tmp;
257+
}
258+
}
259+
else{
260+
261+
if(current[index][parts[0]]){
262+
263+
current[index][parts[0]]+=tmp;
264+
}
265+
else{
266+
267+
current[index][parts[0]]=tmp;
268+
}
269+
}
246270

247-
if(!current[index][parts[0]]){
271+
tmp=parseInt(parts[2],10);
272+
273+
if(current[index]["memory"]){
274+
275+
current[index]["memory"]+=tmp;
276+
}
277+
else{
278+
279+
current[index]["memory"]=tmp;
280+
}
281+
282+
if((repeat===1)&&(!current[index][parts[0]])){
248283

249284
current[index][parts[0]]="-failed-";
250285
}
@@ -253,7 +288,8 @@
253288

254289
if(index<lib.length-1){
255290

256-
setTimeout(runner,200);
291+
mikado.update(index,current[index]);
292+
setTimeout(runner,50);
257293
}
258294
else{
259295

@@ -264,16 +300,30 @@
264300
returnb["score"]-a["score"];
265301
});
266302

303+
for(leti=0;i<lib.length;i++){
304+
305+
lib[i]=current[i]["name"];
306+
}
307+
267308
mikado.render(current);
268-
return;
309+
310+
if(--repeat>0){
311+
312+
index=-1;
313+
setTimeout(runner,50);
314+
}
315+
else{
316+
317+
Mikado.dispatch("start",document.getElementById("start"));
318+
}
269319
}
270320
}
271321
else{
272322

273-
current[index][test[test.indexOf(parts[0])+1]]="run...";
323+
consttmp=Object.assign({},current[index]);
324+
tmp[test[test.indexOf(parts[0])+1]]="run...";
325+
mikado.update(index,tmp);
274326
}
275-
276-
mikado.refresh(index);
277327
}
278328
}
279329
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp