On Thu, Sep 4, 2008 at 10:06 AM, Simon Riggs <[EMAIL PROTECTED]> wrote:
> You don't give the text of the query used to do these performance tests,
> so I can't validate your test results.
>
The attachment is the code to generate the text.
Just
$g++ my-permu-code.cpp
$./a.out > /tmp/words
--
Best Regards,
Xiao Meng
DKERC, Harbin Institute of Technology, China
Gtalk: [EMAIL PROTECTED]
MSN: [EMAIL PROTECTED]
http://xiaomeng.yo2.cn
//-------------------------------------------------------------------------- //
//
// FILE NAME : X937out.cpp
//
// DESCRIPTIVE NAME: Provides X937 Output Plug-in APIs
//
// AUTHOR : Srinivasan MS
//
// MODULE TYPE : C++ Source File
//
//-------------------------------------------------------------------------- //
#include<iostream>
using namespace std;
long long totCount ;
// this function finds the other
// permutations by rotating the string
// in circular manner
void circularPrint(char *str) {
int len = strlen(str);
char *mystr = new char [len +1];
int i,j;
for(i=0; i <len; i++ ) {
for(j=0;j<len; j++ )
mystr[j] = str[(i+j)%len];
mystr[j] =0;
totCount++;
// comment the line below to supress the string output
cout << mystr << endl;
}
delete []mystr;
return ;
}
void permutation(char prefix[],char suffix[])
{
int length=strlen(suffix);
int len = strlen(prefix) ;
int i=0, j=0;
char *myprefix = new char [len];
if(len ) {
strncpy(myprefix, prefix, len - 1 );
myprefix[len-1]= 0;
for(i=0; i< length ; i++) {
char *mysuffix = new char [length+2];
mysuffix[0] = prefix[len-1];
// rotate the current append and prepare append for next
for(j=0; j< length ; j++ ) {
mysuffix[j+1] = suffix[(i+j)%length];
}
mysuffix [j+1]= 0;
permutation(myprefix, mysuffix);
delete []mysuffix;
}
}
else {
// found permutation, now find other
// permutations by rotating the string
circularPrint(suffix);
}
delete []myprefix;
}
int main()
{
char prefix[]="123456789a"; // first N-1 characters of the string of length N
char suffix[]="0"; // last character of the string
time_t t1, t2;
// find permutation
permutation(prefix, suffix);
return 0;
}
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers