CInt Function Stub Removal ROOT Team Meeting CERN Leandro Franco (Joint work with Diego Marcos) 18-06-07.

Slides:



Advertisements
Similar presentations
Math for Liberal Studies. There is a list of numbers called weights These numbers represent objects that need to be packed into bins with a particular.
Advertisements

Quick Review of Apr 10 material B+-Tree File Organization –similar to B+-tree index –leaf nodes store records, not pointers to records stored in an original.
Object Oriented Programming COP3330 / CGS5409.  C++ Automatics ◦ Copy constructor () ◦ Assignment operator =  Shallow copy vs. Deep copy  DMA Review.
May 7, A Real Problem  What if you wanted to run a program that needs more memory than you have?
Lecture 18 Templates, Part II. From Last Time: What is a Template? This is the “official” specification for a template. It says that to define a template.
1 A Real Problem  What if you wanted to run a program that needs more memory than you have?
NAMESPACES AND VISUAL INHERITANCE. OBJECTIVES In this chapter, I will cover the following: Using namespaces Visual inheritance.
1 Homework Turn in HW2 at start of next class. Starting Chapter 2 K&R. Read ahead. HW3 is on line. –Due: class 9, but a lot to do! –You may want to get.
Classes Separating interface from implementation
CS 61C L03 C Arrays (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #3: C Pointers & Arrays
1 Data Structures Data Structures Topic #2. 2 Today’s Agenda Data Abstraction –Given what we talked about last time, we need to step through an example.
Templates. Objectives At the conclusion of this lesson, students should be able to Explain how function templates are used Correctly create a function.
By Jennifer Adams. The traditional approach (or algorithm) for large number division is the most abstract and difficult approach to division. Yet many.
CSE378 Virtual memory.1 Evolution in memory management techniques In early days, single program ran on the whole machine –used all the memory available.
Hank Childs, University of Oregon June 3 rd, 2015 CIS 330: _ _ _ _ ______ _ _____ / / / /___ (_) __ ____ _____ ____/ / / ____/ _/_/ ____/__ __ / / / /
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
Lecture 22 Miscellaneous Topics 4 + Memory Allocation.
Computers in the real world Objectives Understand what is meant by memory Difference between RAM and ROM Look at how memory affects the performance of.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 15: Linked data structures.
Chapter 11 Introduction to Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Bill's Amazing Content Rotator jQuery Content Rotator.
Multi-digit Numerical Long Division 1 © 2013 Meredith S. Moody.
1 C - Memory Simple Types Arrays Pointers Pointer to Pointer Multi-dimensional Arrays Dynamic Memory Allocation.
Axel Naumann University of Nijmegen / NIKHEF, NL ROOT 2004 Users Workshop The Future of THtml Plans and Status of ROOT’s documentation facility.
IT253: Computer Organization
Unit 1 – Improving Productivity Jack Carr Instructions ~ 100 words per box.
Introduction To PROLOG World view of imperative languages. World view of relational languages. A PROLOG program. Running a PROLOG program. A PROLOG.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
1 Inheritance. 2 Why use inheritance?  The most important aspect of inheritance is that it expresses a relationship between the new class and the base.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
THtml  THtml will generate >=1 doc.root file .html pages generated from doc.root files by April (Feb doesn't exist)  Bertrand: extract doc for online.
Getting rid of the “G__” thingies ROOT Team Meeting CERN Diego Marcos && Leandro Franco.
Topic 3: C Basics CSE 30: Computer Organization and Systems Programming Winter 2011 Prof. Ryan Kastner Dept. of Computer Science and Engineering University.
Memory management.
Copyright © 2005 Elsevier Object-Oriented Programming Control or PROCESS abstraction is a very old idea (subroutines!), though few languages provide it.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 RAD due Friday in your Wiki. Presentations week 6 – next week. Schedule on next slide. Today: –Operator.
Programming Fundamentals. Topics to be covered Today Recursion Inline Functions Scope and Storage Class A simple class Constructor Destructor.
Slide 1/29 Informed Prefetching in ROOT Leandro Franco 23 June 2006 ROOT Team Meeting CERN.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – August 23, 2001.
Copyright © 2009 – Curt Hill Standard Template Library An Introduction.
Dialog Processing with Unsupervised Artificial Neural Networks Andrew Richardson Thomas Jefferson High School for Science and Technology Computer Systems.
More about Java Classes Writing your own Java Classes More about constructors and creating objects.
CS2102: Lecture on Abstract Classes and Inheritance Kathi Fisler.
University of Macau Faculty of Science and Technology Programming Languages Architecture SFTW 241 spring 2004 Class B Group 3.
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 3 is due Sunday, the 8 th at 7pm. Problems with assn 3? Discuss at your team meeting tonight.
Computer Science 1620 Sorting. cases exist where we would like our data to be in ascending (descending order) binary searching printing purposes selection.
CSE 332: C++ pointers, arrays, and references Overview of Pointers and References Often need to refer to another object –Without making a copy of the object.
Accelerating Multi-Pattern Matching on Compressed HTTP Traffic Dr. Anat Bremler-Barr (IDC) Joint work with Yaron Koral (IDC), Infocom[2009]
Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID.
Today… Modularity, or Writing Functions. Winter 2016CISC101 - Prof. McLeod1.
Module 9: Operator overloading #1 2000/01Scientific Computing in OOCourse code 3C59 Module 9: Operator Overloading In this module we will cover Overloading.
C++ Functions A bit of review (things we’ve covered so far)
What is New in Core Fons Rademakers 1. Library Reorganization Split off from libCore: libRIO libNet libMath (soon) These libraries are now loaded at run-
Data Structures and Algorithm Analysis Dr. Ken Cosh Linked Lists.
Memory Management.
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Friend Class Friend Class A friend class can access private and protected members of other class in which it is declared as friend. It is sometimes useful.
CSC 322 Operating Systems Concepts Lecture - 16: by
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Creating your first C program
CSE 303 Concepts and Tools for Software Development
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Handling Arrays Completion of ideas needed for a general and complete program Final concepts needed for Final.
Cache writes and examples
Miscellaneous Topics I
CSE 326: Data Structures Lecture #14
Presentation transcript:

CInt Function Stub Removal ROOT Team Meeting CERN Leandro Franco (Joint work with Diego Marcos)

Modifying CInt?... A.K.A : The Piñata paradigm CInt Newbie Experienced Programmers Goal: Obtain the candies from the piñata... without breaking anybody's head.

Simple Idea ● The dictionaries are big: around 52% of the total library size. ● Why don't we just wipe them off from the face of earth? ● Short answer: we can't do it yet, but we will try. ● Long answer: the whole topic of these slides ;)

First steps ● One good way to shrink the dictionaries is to remove the stub functions. ● Such functions come from the need of having a generic way to call a function in Cint and from the impossibility of doing a proper name mangling to find such function (i.e. Cint must behave as a compiler but doesn't have the means to do so).

Stub Functions ● To be able to solve the name mangling problem a traditional approach was taken: “Any problem in computer science can be solved with another layer of indirection” Wheeler's Law

Stub Functions Compiler/CInt Library function CIntLibrary functionDictionary mangling compiling time pseudo mangling running time mangling compiling time The dictionary could be seen as a bijective function that maps c++ function declarations to a certain string (string which will be associated to the symbol by the compiler)

Stub Functions ● The idea is to avoid that layer of indirection. – We still don't how to do the mangling. ● But we know how to do the demangling (or at least, we know who to call to do it ;) ). function header (X)library (Y) A::A() _ZN1AC1Ev A::HiA() _ZN1A3HiAEv Instead of going from set X to set Y for a given x in X function header (X)library (Y) A::A() _ZN1AC1Ev A::HiA() _ZN1A3HiAEv Go from set Y to set X for all y in Y

Stub Functions ● This approach writes in stone the biggest side effect: – We will need to demangle ALL the symbols in a library just to be able to call 1 function. ● The demangling process might not be too expensive but what happens when we have thousands and thousands of symbols in a library?

Efficiency ● Since we have to demangle all the symbols from the library at least once we could cache this result – Expensive approach: libCore has symbols with an average length of 46 characters when demangled (i.e 614 KB in cache). ● Try to demangle as less as possible. Don't do it more than once or twice and don't even try it if the symbols have been registered. ● I'm not even mentioning the parsing needed between the demangling and the registering.

Are we winning the fight? ● CVS version of ROOT – Libs size: MB – Objects size (dictionaries): MB – Source size (dictionaries):50.37 MB ● Current status of pre-experimental version – Libs size:65.46 MB ( MB, 12%) – Objects size (dict):36.42 MB ( MB, 24%) – Source size (dicti):37.25 MB ( MB, 26%)

In all war sacrifices must be made: space and time overhead Let's start with a “normal” sesion Real time: 0.37 sReal time: s Rootmarks:

First Algorithm: be stupid. Initial attempt: demangle all the symbols in a library for every used class Real time: 0.76 sReal time: s Rootmarks: 184 Spikes due to the silliness of the algorithm. First demangle everything and the register it.

Second Algorithm: don't be so stupid At least remember the classes that have already been registered Real time: 0.77 sReal time: s Rootmarks: Spikes due to the silliness of the algorithm. First demangle everything and the register it.

Third Algorithm: use the RAM Demangle the symbols once and keep them in a cache Real time: 0.69 sReal time: s Rootmarks:

Fourth Algorithm: Axel's idea Keep a pointer to the mangled name and demangle twice (when needed) Real time: 0.68 s Real time: s Rootmarks:

Fifth Algorithm: some tuning A bit of optimization with the structures Real time: 0.56 sReal time: s Rootmarks: 200.1

Algorithms Comparison How much are we willing to pay for this feature??? Demangling takes 15% of the time at startup (100ms). Which means there is still some room for improvement.

Problems so far... a plethora ● Easy ones – ellipsis – parameters by default – free standing functions – weird types like va_list – many more... ● Not so easy: – virtual functions... a real pain in the neck – constructors, destructors (in-charge, deleting, etc) – inline functions – non-member operators –...

Work to be done ● Certain stub functions are not out of the dictionary yet: – Constructors and destructors (Diego is working on it) – Non-member operators – Certain cases for std templates ● Without stubs we can also take the setup_memfunc calls out of the dictionary. ● What else can we take out? – Shadow classes? Show members? Streamers? – Class Inheritance info? typedef? data members info?...?

Future is always bright (dict source) ● CVS Version:50.37MB ● Actual status:37.25MB ( MB, 26.0%) ● No cons, dests:30.09MB ( MB, 40.2%) – Should be there soon enough. ● No memfuncs:17.40MB ( MB, 65.4%) – We still need the info (in a root file for instance). ● No memvars:14.72MB ( MB, 70.7%) ● No inline issue:13.89MB ( MB, 72.4%)

Conclusions ● We have gained a better understanding of C++. ● As my mother used to say: – He who knows not the way, walks with desperation. (fortunately, we finally have an idea of what we are doing and where we want to go) ● A lot of tuning is being done to bring times and memory down to something acceptable. ● We need a considerable amount of time to deal with a myriad of small (and not so small) issues.