hg serve is soo slow

Laurens Holst laurens.nospam at grauw.nl
Tue Sep 25 17:35:43 CDT 2012


Op 25-9-2012 23:57, Martin Scotta schreef:
> this works fine for me...
> the trick is to process buckets 25 dates each time, and delaying the 
> execution of the rest 10ms which gives some time to the browser to 
> handle other threads.
>
> Not the best thing, best would be handle these manipulation at backend 
> side.
>
> return function() {
>         var ageclass = /\\bage\\b/,
>             dateclass = /\\bdate\\b/,
>             nodes = document.getElementsByClassName ? 
> document.getElementsByClassName('age')
>                                                     : 
> document.getElementsByTagName('*'),
>             length = nodes.length, i=0;
>         // delayed execution for responsiveness
>         !function  process() {
>             // each time process only some dates
>             for (var b = 0; b < 25; b++) {
>                 var node = nodes[i++];
>                 // we may destroy nodes as we process them
>                 if (node && node.textContent) {
>                     var classes = node.className;
>                     if (document.getElementsByClassName || 
> ageclass.test(classes)) {
>                         var agevalue = age(node.textContent);
>                         if (dateclass.test(classes)){
>                             // We want both: date + (age)
>                             node.textContent += ' ('+agevalue+')';
>                         } else {
>                             node.textContent = agevalue;
>                         }
>                     }
>                 }
>             }
>             if (i < length) setTimeout(process, 10);

You can just use setTimeout(process, 0). This will allow other things to 
be handled before it continues, no need to make it wait 10ms.

Also I would think you should easily be able to increase the bucket size 
to say, a 1000 at a time.

~Laurens

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120926/ee26398b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: laurens_nospam.vcf
Type: text/x-vcard
Size: 141 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120926/ee26398b/attachment.vcf>


More information about the Mercurial-devel mailing list