Article View: news.software.nntp
Article #62437Re: xBin (Power-Post 2003 - requesting input from authorities..)
From: Curt Welch
Date: Tue, 24 Dec 2002 08:49
Date: Tue, 24 Dec 2002 08:49
99 lines
5839 bytes
5839 bytes
Rene <invalid@email.addr> wrote: > Lucky me, can't find some sleep... *sigh* > > curt@kcwc.com (Curt Welch) wrote: > > I could easilly be wrong about SHA-1. I don't think I've ever looked > > into it. I just made the assumption it worked on 20 byte blocks in a > > similar way to how MD5 works. > > > > MD5 however is a block hash which works on 16 byte blocks. It is > > structured to run though it's algorithm once for each 16 byte block. > > If you give it 17 bytes to hash, it pads the last block and runs the > > hash algortihm twice making it take twice as long as for 16 bytes. > > Nope, sorry. That's wrong too. Ok, so I give up on that point. :) I'll have to go look into this some time. > > Here are three runs of my code calculating the tree hash of a 50MB file > > (where the file is all in the memory cache of the server so no disk IO > > happened): > > Well actually loading and processing the file would have been more > interesting... The slowest part of all this WILL be the disk i/o. Memory > access is always fast. Testing it now - it took 5.4 seconds total to read the disk blocks and do the calculatlions for the 50MB file (compared to the 2.5 seconds to just calcuate the hash when all the disk blocks were in-core). And the system I'm running it on is busy being a news transit box at the same time moving about 40 Mbits of traffic. > > Looking at the user time (u), the 4500 block code seemed to run faster > > than the 4096 byte code. But more important, the difference is so > > small > > Yes the difference is too small. It probably will still be small with > actual disk i/o but you already seem to have your test-program around, so > can you repeat this test with a non-cached file? I did it with the same file I used before, but I would expect none of it to be left in the cache. It's hard to tell for sure however. Here is a run against a 2GB file that's not likely to be cached using a hash block size of 4096: 81.207u 32.254s 3:02.80 62.0% 21+42966k 32204+0io 0pf+0w That works out to 4.5 seconds per each 50MB. And another 2GB file with a block size of 4500: 80.720u 30.956s 2:34.85 72.1% 21+38537k 32075+0io 0pf+0w CPU is almost identical, elapsed time is somewhat different, but the machine is under a load so that's not going to mean a lot. FileIO shows 32K read operations for both which is interesting because that implies the reads were 64K blocks. I don't know what that number is tracking (OS reads to the disk, application reads to the disk cache, sys calls???) > However it was my > intention that the last line could be made shorter - so assuming that > this is the eof would be correct. You probably meant to write that this > uudecode cannot handle that correctly and adds junk (which subsequently > will get that block marked corrupt by the hash-algorithm) The uuencode format includes a size value at the front of every line (M means 45), and the file should not end until you see the "end" marker, and all uuencode implementations must support a short last line, so you would think that any uudecoding software would "work" if short lines were included in the middle of the file, but with Usenet, you just never know. Multipart uuencoded posts never noramally have a part which ends with a shorter line. You can't help but wonder if some tool somewhere is going to choke if you do something non-standard like that. Maybe some decoder will see the line as a sign of a corrupted post and just abort? If we make xBin posting tools create non-standard uuencoded files, and one tool somewhere starts rejectiong these posts, and then they find out that since 4096 blocks are the standard for xBin that it's impossible to fix this, the people that use this will start their own "xBin sucks" campaign. It could be that every single uudecoding tool in use on Usenet today will work correctly with multipart uuencode files with the last line of each multipart being short. But after 15 years of not doing that way, I really don't want to risk it. And though a non power-of-two block size seems odd, I can't find any technical reason to belive it's important for anything. > Damn, not a bit more tired now... You must be excited about Christmas! :) -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20021224034919.081$PY@newsreader.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.stealth.net!news.stealth.net!news-out.visi.com!hermes.visi.com!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com> <20021223041127.986$6M_-_@newsreader.com> <1rfzsoaacf.fsf@vingodur.ifi.uio.no> <20021223180543.105$Wn@newsreader.com> <20021223185652.700$BS@newsreader.com> <20021223203608.351$Qp@newsreader.com> <20021223223311.286$Mx@newsreader.com>Show Full Headers
Complete Article Headers
Message-ID: <20021224034919.081$PY@newsreader.com>
Subject: Re: xBin (Power-Post 2003 - requesting input from authorities..)
Date: Tue, 24 Dec 2002 08:49:19 +0000
From: curt@kcwc.com (Curt Welch)
References: <cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com> <20021223041127.986$6M_-_@newsreader.com> <1rfzsoaacf.fsf@vingodur.ifi.uio.no> <20021223180543.105$Wn@newsreader.com> <20021223185652.700$BS@newsreader.com> <20021223203608.351$Qp@newsreader.com> <20021223223311.286$Mx@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.stealth.net!news.stealth.net!news-out.visi.com!hermes.visi.com!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com W6Cxy2B=6wb0Fp_XUkmk,mk9A=W3DTH=qRqYgD.TXFNpoO6t@
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
%IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 98