[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] oprofile data for mtn 0.37.
From: |
Zack Weinberg |
Subject: |
Re: [Monotone-devel] oprofile data for mtn 0.37. |
Date: |
Thu, 13 Mar 2008 10:41:11 -0400 |
On Wed, Mar 12, 2008 at 5:46 PM, Jack Lloyd <address@hidden> wrote:
> On Wed, Mar 12, 2008 at 05:19:50PM -0400, Zack Weinberg wrote:
> > It occurs to me that we (monotone) create and destroy one Botan::Pipe
> > and at least one subclass of Botan::Filter for every call to most of
> > the functions in transform.hh. If there's a global lock around
> > allocating the memory for that, that could explain it.
>
> Yup. At least one and actually probably several.
[...]
Given this, it occurred to me to try to cache constructed Pipe
objects, so that we avoid both the locking overhead and all other
construction overhead, in particular heap-allocation of memory blocks
&c.
Unfortunately, I can't make this work. My code uses the Botan APIs in
the same way as this test program:
#include <string>
#include <iostream>
#include <botan/botan.h>
using std::string;
using std::cin;
using std::cout;
using Botan::Pipe;
using Botan::Hash_Filter;
using Botan::Hex_Encoder;
int
main(void)
{
Pipe p(new Hash_Filter("SHA-160"), new Hex_Encoder);
string buf;
for (;;)
{
getline(cin, buf);
if (cin.eof()) break;
cout << '[' << buf << ']' << '\n';
p.process_msg(buf);
cout << '|' << (p.read_all_as_string()) << '|' << '\n';
}
}
which only produces the SHA1 hash of the first line of input; the
intent is to hash each line separately.
$ cat test.txt
the quick brown fox jumps over the lazy dog
pack my box with five dozen liquor jugs
waltz, nymph, for quick jigs vex Bud
$ ./a.out < test.txt
[the quick brown fox jumps over the lazy dog]
|16312751EF9307C3FD1AFBCB993CDC80464BA0F1|
[pack my box with five dozen liquor jugs]
||
[waltz, nymph, for quick jigs vex Bud]
||
What am I doing wrong?
zw
- [Monotone-devel] oprofile data for mtn 0.37., jack-monotone, 2008/03/12
- Re: [Monotone-devel] oprofile data for mtn 0.37., Zack Weinberg, 2008/03/12
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/12
- Re: [Monotone-devel] oprofile data for mtn 0.37., Zack Weinberg, 2008/03/12
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/12
- Re: [Monotone-devel] oprofile data for mtn 0.37.,
Zack Weinberg <=
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Zack Weinberg, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Zack Weinberg, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Zack Weinberg, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/14
- Re: [Monotone-devel] oprofile data for mtn 0.37., Zack Weinberg, 2008/03/13
- Re: [Monotone-devel] oprofile data for mtn 0.37., Jack Lloyd, 2008/03/13