opensource.google.com

Menu

C++ containers that save memory and time

Thursday, January 31, 2013


We’re pleased to announce C++ B-Tree, a C++ template library that implements B-tree containers with an analogous interface to the standard STL map, set, multimap, and multiset containers. B-trees are well-known data structures for organizing secondary storage, because they are optimized for reading and writing large blocks of data. But the same property that makes B-trees appropriate for use with databases and file systems also makes them appropriate for use in main-memory, just with smaller blocks.

C++ standard libraries commonly implement the map and set data structures using Red-Black trees, which store one element per node, requiring three pointers plus one bit of information per element to keep the tree balanced. By comparison, B-tree containers store a number of elements per node, thereby reducing pointer overhead and saving a significant amount of memory. For small data types, B-tree containers typically reduce memory use by 50 to 80% compared with Red-Black tree containers.


insertion time as a function of tree size
(256 byte node)


Storing multiple elements per node can also improve performance, especially in large containers with inexpensive key-compare functions (e.g., integer keys using less-than), relative to Red-Black tree containers. This is because performance in these cases is effectively governed by the number of cache misses, not the number of key-compare operations. For large data sets, using these B-tree containers will save memory and improve performance.


insertion time as a function of node size
(10M element tree)


These templates are nearly drop-in compatible with the STL map, set, multimap, and multiset types, with one significant exception. Unlike the standard container types, insertions and deletions invalidate outstanding iterators (we provide “safe” alternatives to handle this case).


By Josh MacDonald, 20% Contributor













Google Code-in 2012: it’s numbers time

Tuesday, January 29, 2013


Earlier this month, Google Code-in, a contest introducing 13-17 year olds to open source software development, finished up with really exciting results.

We had 334 students from 36 countries complete 1,925 tasks in the 7 week contest.  Students worked with 10 open source organizations on coding, documentation, training, user interface, research, outreach tasks, and quality assurance tasks. 58.7% of students completed at least 3 tasks in the contest.

Countries
The countries with the most students completing tasks are shown in the pie chart below:
This year there were 5 countries who for the first time had students complete tasks in Google Code-in: China, Kenya, Kuwait, Trinidad and Tobago, and Uruguay.

Pre-university/high schools
The 5 schools with the most students completing tasks in Google Code-in 2012 are listed below.
- Technical School Electronic Systems (associated with Technical University- Sofia) in Bulgaria had the most students participating in the contest for the second year in a row with 44!
- Dunman High School in Singapore had 13 students participate in this year’s contest (only 1 student from all of Singapore participated last year).
There was a 3 way tie between the following schools to wrap up the 5 participating schools:
- Marc Garneau Collegiate Institute in Canada
- Precious Blood Secondary School in Kenya (an all girls school)
- Colegiul National “Mircea cel Batran” in Romania

Age of Students

Mentors
There were 174 dedicated mentors from 40 countries guiding students throughout the contest. This year we had mentors from a few new countries including Macedonia, Panama, Paraguay, Uruguay, and the Slovak Republic.

A huge thank you to all of the students, mentors and organization administrators who made Google Code-in 2012 a success! And thank you to all the parents and teachers who encouraged students to learn more about open source software development!

Stay tuned to this blog for the announcement of the 20 Grand Prize winners on February 4th.

By Stephanie Taylor, Open Source Programs Office

XBMC Rocked the Summer

Thursday, January 24, 2013



XBMC is an open source software media player and entertainment hub available on Windows, OSX, Linux, and iOS, and available in beta form on Android and the Raspberry Pi.

2012 was XBMC's second year participating in Google Summer of Code, having previously been involved back in 2008, and it was enormously successful with all four accepted students completing their projects and adding valuable code to the XBMC base.

Sascha Montellese set out to provide a simpler and more powerful method for filtering the contents of a user's XBMC Media library. While theoretically a simple task, Sascha found himself upgrading virtually every piece of the XBMC library/database, providing vast improvements for the entire user experience, all to ensure that his advanced filter could reliably filter by nearly all popular media categories, including rating, progress, release date, genre, etc.

While Sascha sought to make the data in XBMC's library more easily accessible for users, Tobias Arrskog's goal was to more efficiently and effectively gather that data from the internet using a data-driven approach. After extensive statistical research, Tobias created a data scraper called Heimdall, designed to be both more efficient and "future proof," allowing for the addition of future media types, such as games.

Tobias sought to improve the data inside the XBMC library and Sascha sought to improve the XBMC library itself. Alasdair Campbell, in turn, sought a way to better share the media of the XBMC library with a user's entire media viewing ecosystem. To that end, Alasdair's project was to improve UPnP support on the XBMC UPnP server. By the end of the summer, Alasdair had realized a great deal of his goal, marking the first steps to a truly practical XBMC Server.

Finally, Andres Mejia's project differed somewhat from the other three projects. While the other projects were designed to enhance the XBMC library in various ways, Andres was tasked with creating an XBMC Test Suite so that XBMC developers could more easily test for various bugs before, during, and after the build process. Andres's Test Suite was merged into the XBMC codebase at the end of the summer.

When XBMC applied for Google Summer of Code in 2012, our entry was thought of primarily as a nice community event that could get more developers excited about the project. It has been incredible to discover the extent to which this program has vastly improved the codebase in ways that are reaching our users almost immediately. We will be very excited to apply for future instances of Google Summer of Code.

By Nathan Betzen, XBMC Google Summer of Code Administrator
.