From: Xiao Meng <mx.cogito@gmail.com>
To: Simon Riggs <simon@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
Subject: Re: [PATCHES] hash index improving v3
Date: Thu, 4 Sep 2008 21:03:45 +0800
Message-ID: <ded849dd0809040603h5db026e7l6df516c3f1e5dd74@mail.gmail.com> (raw)
In-Reply-To: <1220494002.4371.813.camel@ebony.2ndQuadrant>
References: <ded849dd0808171846g2c6c65adub942bd2510a6c94f@mail.gmail.com>
<1220494002.4371.813.camel@ebony.2ndQuadrant>
On Thu, Sep 4, 2008 at 10:06 AM, Simon Riggs <simon@2ndquadrant.com> 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: mx.cogito@gmail.com
MSN: cnEnder@live.com
http://xiaomeng.yo2.cnAttachments:my-permu-code.cpp (text/x-c++src, 1.8K) download
//-------------------------------------------------------------------------- //
//
// 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;
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-patches@postgresql.org
Cc: mx.cogito@gmail.com, simon@2ndquadrant.com, pgsql-hackers@postgresql.org
Subject: Re: [PATCHES] hash index improving v3
In-Reply-To: <ded849dd0809040603h5db026e7l6df516c3f1e5dd74@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox