473,762 Members | 8,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

The SETT Programming Contest: The fastest set<T> implementation

The SETT Programming Contest: The fastest set<Timplementa tion

Write the fastest set<Timplementa tion using only standard C++/C.
Ideally it should have the same interface like std::set.
At least the following methods must be implemented:
insert(), find(), begin(), end(), erase(), size(), operator<(),
and at least the forward iterator.

Here, speed and correctness are the 2 most important factors.
Functionally it should behave similar to std::set,
have practically no limitation on the number of items,
and be significantly faster, either always or under specified
conditions (for example for random items etc.).

The class should be placed in an own namespace.
Supply also a benchmark routine which compares your
implementation with that of std::set, and briefly document
and comment these results.

Hint: Since items in a set are always in an ordered sequence
(as determined by operator<()) you need to use some tree
routines (AVL, red-black, splay, etc.) or use your own tree
method in the heart of your implementation.

See also this paper:
Ben Pfaff, "Performanc e Analysis of BST in System Software", Stanford University
http://www.stanford.edu/~blp/papers/libavl.pdf

Publish your finished project somewhere on the Web
(for example at your own homepage or at http://sourceforge.net/ )
and announce it in comp.lang.c++ .

There is no deadline on this contest. The fastest method
will be the winner of the SETT Programming Contest,
until someone comes up with a faster method.

Good Luck!

Jun 27 '08 #1
22 2707
"SETT Programming Contest" <se**@sett.prog ramming.contest .org.invalidwro te
in message news:g2******** **@aioe.org...
The SETT Programming Contest: The fastest set<Timplementa tion
What's the prize?

[...]

Jun 27 '08 #2
SETT Programming Contest wrote:
The SETT Programming Contest: The fastest set<Timplementa tion
Considerable speedups can be achieved by simply using the default
std::set with a custom memory allocator. I have done exactly that here:

http://warp.povusers.org/FSBAllocator/

I suppose that could be my entry.
Jun 27 '08 #3
On Jun 3, 4:55 pm, "SETT Programming Contest"
<s...@sett.prog ramming.contest .org.invalidwro te:
The SETT Programming Contest: The fastest set<Timplementa tion

Write the fastest set<Timplementa tion using only standard C++/C.
Ideally it should have the same interface like std::set.
At least the following methods must be implemented:
insert(), find(), begin(), end(), erase(), size(), operator<(),
and at least the forward iterator.

Here, speed and correctness are the 2 most important factors.
Functionally it should behave similar to std::set,
have practically no limitation on the number of items,
and be significantly faster, either always or under specified
conditions (for example for random items etc.).

The class should be placed in an own namespace.
Supply also a benchmark routine which compares your
implementation with that of std::set, and briefly document
and comment these results.

Hint: Since items in a set are always in an ordered sequence
(as determined by operator<()) you need to use some tree
routines (AVL, red-black, splay, etc.) or use your own tree
method in the heart of your implementation.

See also this paper:
Ben Pfaff, "Performanc e Analysis of BST in System Software", Stanford Universityhttp://www.stanford.ed u/~blp/papers/libavl.pdf

Publish your finished project somewhere on the Web
(for example at your own homepage or athttp://sourceforge.net/)
and announce it in comp.lang.c++ .

There is no deadline on this contest. The fastest method
will be the winner of the SETT Programming Contest,
until someone comes up with a faster method.

Good Luck!
Interesting contest. However, the assumption that there should be no
limitation on the number of items implies that the underlying memory
management model will be similar to the one used by std::set. It
appears that a change to this memory model (particularly within modern
multi-threaded environments) may have a more dramatic affect on
performance benchmarks, then the selection of the underlying data
structure, as demonstrated by the String library
(see: http://strinx.sourceforge.net/docs/strinx.html).

ShacharS.
Jun 27 '08 #4
"SETT Programming Contest" <se**@sett.prog ramming.contest .org.invalidwri tes:
The SETT Programming Contest: The fastest set<Timplementa tion

Write the fastest set<Timplementa tion using only standard C++/C.
Ideally it should have the same interface like std::set.
[snip]

What is "C++/C"?

Since C doesn't have C++-style templates or namespaces, the problem as
stated cannot be solved in C (though you could probably do the
equivalent).

Why not just say "standard C++" and leave C out of it?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #5
As others have observed, the conditions stop C being used.

The basic issue for most set implmentations is that insert/delete is slowest
as memory allocation/deallocation occurs per-node.
If you double this, the perforamance of set doubles.
So an allocator geared towards allocation of nodes the same size is where
time should be spent.

Stephen Howe


Jun 27 '08 #6
"Keith Thompson" <ks***@mib.orgw rote:
"SETT Programming Contest" writes:

The SETT Programming Contest: The fastest set<Timplementa tion

Write the fastest set<Timplementa tion using only standard C++/C.
Ideally it should have the same interface like std::set.
[snip]

What is "C++/C"?

Since C doesn't have C++-style templates or namespaces, the problem as
stated cannot be solved in C (though you could probably do the
equivalent).

Why not just say "standard C++" and leave C out of it?
It means that you can also use pure C for the underlying methods,
ie. by using the 'extern "C"' interface mechanism of the C++ compiler.
Only the public interface must be in C++, the rest can also be
in portable standard C. For example if you already have some
working C code (for example the tree routines) for re-use here...

Jun 27 '08 #7
On Jun 4, 4:37*am, "SETT Programming Contest"
<s...@sett.prog ramming.contest .org.invalidwro te:
"Richard Harter" <c...@tiac.netw rote:
"SETT Programming Contest" wrote:
>Write the fastest set<Timplementa tion using only standard C++/C.
>Here, speed and correctness are the 2 most important factors.

In-memory methods only; much like std::set
Too bad the contest doesn't include memory needs as a
criterion; I've a method with the same compaction as
Cleary's Compact Tree, but faster -- though not as fast as
non-compact methods.

Obviously, a compact method will be faster than a "fast"
method, if the former fits in core and the latter doesn't.

James Dow Allen
Jun 27 '08 #8
SETT Programming Contest wrote:
The SETT Programming Contest: The fastest set<Timplementa tion

Write the fastest set<Timplementa tion using only standard C++/C...
That basically rules out persistence and efficient set theoretic operations.

The set implementations in languages like OCaml are up to a million times
faster in practice but to be competitively performant without missing
features you would need to Greenspun an efficient GC in C++ (and
assembler). So why restrict your competition to archaic languages like C++?

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com/products/?u
Jun 27 '08 #9
On Jun 3, 3:55 pm, "SETT Programming Contest"
<s...@sett.prog ramming.contest .org.invalidwro te:
The SETT Programming Contest: The fastest set<Timplementa tion
Write the fastest set<Timplementa tion using only standard
C++/C.
Fastest at what? On what machine? With which implementation of
C++?

[...]
See also this paper:
Ben Pfaff, "Performanc e Analysis of BST in System Software", Stanford Universityhttp://www.stanford.ed u/~blp/papers/libavl.pdf
Which more or less establishes that "fastest" is meaningless
unless you define at what?

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
10897
by: Harald Grossauer | last post by:
Usually STL containers have something like "iterator container<>::erase(iterator)" which erases the element the iterator points to and returns another valid iterator. Set does not have this, set::erase() returns void and "invalidates" the iterator. Now I have the following code: while(!some_set.empty()) { for(it = some_set.begin(); it != some_set.end(); it++) {
16
2717
by: Mars | last post by:
I'm writing a program for listing all binary numbers of the same length with the same number of 1s. e.g. 0011 0101 0110 1001 1010 1100
7
5770
by: Renzr | last post by:
I have a problem about the std::set<>iterator. After finding a term in the std::set<>, i want to know the distance from the current term to the begin(). But i have got a error. Please offer me help, thank you. I am a freshman about the STL. The following is the code. #include <set> #include <iostream> #include <vector> int main() {
0
9378
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10137
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7360
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3914
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.