Article View: pl.comp.lang.javascript
Article #49636Re: złożoność obliczeniowa
From: zlotowinfo
Date: Thu, 07 Jan 2010 09:31
Date: Thu, 07 Jan 2010 09:31
33 lines
1632 bytes
1632 bytes
więc pozostaje pętla, wyniki:
IE7 - pętla 1s, wersja z join 6s
SAPHARI - pętla 0s, wersja z join 1s
FIREFOX - pętla 1s, wersja z join 2s
OPERA - pętla 1s, wersja z join 2s
function r1(cyfra, ile2)
{
while(cyfra.length<ile2){cyfra=' '+cyfra;}
return cyfra;
}
function r2(cyfra, ile2)
{
var len = ile2 - cyfra.length;
var pad = new Array(len > 0 ? len : 0).join(' ');
cyfra = pad + cyfra;
return cyfra;
}
czas1 = new Date();czas1=czas1.getSeconds();
for(i=0;i<=700000;i++)
{
x=r1(1,20)
}
czas2 = new Date();czas2=czas2.getSeconds();
document.write(czas2-czas1);
Technical Details
Message-ID:
<hi49kv$cdl$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailReferences:
<hhe2u5$pom$1@inews.gazeta.pl> <hhhstr$91d$1@inews.gazeta.pl> <hhlbra$oi3$1@inews.gazeta.pl> <hi2460$1ek$1@news.onet.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: "zlotowinfo" <usuntousun@go2.pl> Newsgroups: pl.comp.lang.javascript Subject: Re: złożoność obliczeniowa Date: Thu, 7 Jan 2010 10:31:09 +0100 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 12 Message-ID: <hi49kv$cdl$1@inews.gazeta.pl> References: <hhe2u5$pom$1@inews.gazeta.pl> <hhhstr$91d$1@inews.gazeta.pl> <hhlbra$oi3$1@inews.gazeta.pl> <hi2460$1ek$1@news.onet.pl> NNTP-Posting-Host: 77-45-32-80.sta.asta-net.com.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1262856671 12725 77.45.32.80 (7 Jan 2010 09:31:11 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Thu, 7 Jan 2010 09:31:11 +0000 (UTC) In-Reply-To: <hi2460$1ek$1@news.onet.pl> X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18005 X-Priority: 3 X-Newsreader: Microsoft Windows Mail 6.0.6002.18005 X-User: zlotowinfo X-MSMail-Priority: Normal Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit