wb-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wb-discuss] Re: Wb-discuss Digest, Vol 5, Issue 3


From: zhang xin cheng
Subject: [Wb-discuss] Re: Wb-discuss Digest, Vol 5, Issue 3
Date: Fri, 16 Apr 2010 14:27:25 -0400

I have some problem regarding the remove.
I do some test to add 1000 items in the btree, and remove them,
I use bt-get and check all things have been removed, however, the size of the file which store the btree has not decrease.
code:
for (i = 1; i <= 1000; i ++)
{
for (j = i, k = 5; k >= 0; j /= 10, k --)
{
tmp_str[k] = j % 10 + 48;
tmp_str[6] = 0;
}
bt_write(&han, (unsigned char *)tmp_str, 7, (unsigned char *)tmp_str, 7);
// time1 = (double)clock();
// if (time1 - time0 >= 1000)
// {
// time0 = time1;
// printf("%.4lfms\n", time0);
// printf(" %d\n", i);
// }
//printf("%.4lfms\n", (time1 - time0) / i);
}
time1 = (double)clock();
printf("%.4lfms\n", time1);
printf("start search\n");

for (i = 1; i <= 1000; i ++)
{
for (j = i, k = 5; k >= 0; j /= 10, k --)
{
tmp_str[k] = j % 10 + 48;
tmp_str[6] = 0;
}
bt_next(&han, (unsigned char *)tmp_str, 7, (unsigned char *)ans_str);

// printf("%s\n", ans_str);
}
time1 = (double)clock();

printf("%.4lfms\n", time1);
printf("start rem\n");
for (i = 1; i <= 1000; i ++)
{
for (j = i, k = 5; k >= 0; j /= 10, k --)
{
tmp_str[k] = j % 10 + 48;
tmp_str[6] = 0;
}
printf("%d\n", bt_rem(&han, (unsigned char *)tmp_str, 7, (unsigned char *)ans_str));

printf("%s\n", ans_str);
}

Thanks for your help.

Best,
Xincheng

On Fri, Apr 16, 2010 at 12:02 PM, <address@hidden> wrote:
Send Wb-discuss mailing list submissions to
       address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.gnu.org/mailman/listinfo/wb-discuss
or, via email, send a message with subject or body 'help' to
       address@hidden

You can reach the person managing the list at
       address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Wb-discuss digest..."


Today's Topics:

  1. Re: WB relational database (Aubrey Jaffer)


----------------------------------------------------------------------

Message: 1
Date: Thu, 15 Apr 2010 14:44:18 -0400 (EDT)
From: Aubrey Jaffer <address@hidden>
Subject: [Wb-discuss] Re: WB relational database
To: zhang xin cheng <address@hidden>
Cc: address@hidden, address@hidden
Message-ID: <address@hidden>

 | Date: Wed, 14 Apr 2010 13:18:37 -0400
 | From: zhang xin cheng <address@hidden>
 |
 | ...
 | We wanna store the tuples in the b-tree. But I am wondering how I
 | gonna do query them by one of the element in the tuple.  e.g.
 |   ppl, score
 | (John, 92)
 | (Mike, 83)
 | (Kevin, 92)
 |
 | how I gonna select where o = 92.
 |
 | Do u have some suggestions or Wbtree can build relational database
 | in some way?

SLIB has a relational-database module
<http://people.csail.mit.edu/jaffer/slib_6.html> which works with
rWB-ISAM <http://people.csail.mit.edu/jaffer/wb_7.html> in SCM
<http://people.csail.mit.edu/jaffer/SCM>.

The Windows-installer for SCM includes WB.  Follow the "x86 MS-Windows
Installation" instructions on
<http://people.csail.mit.edu/jaffer/FreeSnell>.

 | Btw, I also wanna know the time complexity of bt-scan, it use
 | b-tree structure or it just scan all the leaves of the btree?

It scans the leaves rather than repeatedly descending from the root,
making it O(N) instead of O(N log(N)).

 | There is no threading in Windows since I saw that by preprocessor
 | of C compiler, it didn't include pthread.h under windows
 | environment right, so there is no thread implementation for
 | windows?

Concurrent execution is supported in Windows.
In "wbsys.c" WB uses Windows _InterlockedExchange()
<http://msdn.microsoft.com/en-us/library/ms683590%28VS.85%29.aspx> as
its mutex when compiled by _MSC_VER (Microsoft Visual Studio).

To use pthreads under Windows, try adding "#define unix" to "wbsys.h".
You may need to add "#undef unix" to the top of "blkio.c".  If that
works, I will rework the unix conditionals.




------------------------------

_______________________________________________
Wb-discuss mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/wb-discuss


End of Wb-discuss Digest, Vol 5, Issue 3
****************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]