[Botan-devel] Small file ciphering speed

Mr Diggilin mr.diggilin at gmail.com
Fri Sep 26 04:46:20 EDT 2008


On Thu, 2008-09-25 at 13:20 -0400, Jack Lloyd wrote:
> > Note that that speed
> > is measuring nothing but start_msg() to end_msg().
> > As for raw cipher speed not including initialization in this case...
> > Encryption: 671 ms
> > Decrypt/compare: 701 ms
> > A bit of calculation guesstimates that at a bit less than 1mbps.
> 
> !!!
> 
> Are you buffering inputs to Pipe? Byte-at-a-time vs page-at-a-time can
> easily cause an order of magnitude difference.
> 
> Also: is this processor 32 or 64 bit? Which version of GCC are you
> using? Can you send the contents of /proc/cpuinfo?

Missed a bit of info here...
GCC version is 4.3-39.1, 32 bit processor.

I will note clearly here that 1mbps is the speed I estimated that got
when I ran your test case. I no longer believe this to be accurate, I
probably didn't get the right number of bytes of input. As you can see
in my previous letter, it's about 2 megabytes per second.

As far as buffer vs byte, my reading from wxWidgets streams to Botan
streams was loosely based on the >> operator for std streams to botan
pipes. Implementation as follows:

wxInputStream& operator>>(wxInputStream& stream, Pipe& pipe)
{
  //using the botan buffer size of, if I recall, 4096 bytes
  SecureVector<byte> buffer(DEFAULT_BUFFERSIZE);
  int StreamLength = stream.GetSize() - stream.TellI();

  while(StreamLength > 0)
  {
    stream.Read(reinterpret_cast<char*>(buffer.begin()), buffer.size());
    StreamLength -= stream.LastRead();
    pipe.write(buffer, stream.LastRead());
  }
  return stream;
}






More information about the botan-devel mailing list