Project Title: Skype Phone Number Recognizer refactoring
The Challenge
Our customer - Skype, a worldwide leader in VoIP communication, needed to improve performance of their tool - phone number recognizer (PNR).Softage consultants successfully approached the problem. The first phase of the project was to perform analysis of the existing code and prepare detailed report on the results. The challenge was to identify and locate bottlenecks and problems in the code impacting the tool performance and stability.
After completion of the analysis, the customer asked to refactor the code.
Mains tasks of code refactoring were:
- Increasing application performance and stability. Increasing amount of numbers found and quality of recognition (better phone number attributes recognition – land line, fax, mobile number).
- Code porting to Mac OS X and Linux
Additional requirements: - Size of compiled code should not significantly increase.
Quality of search should be high. At least same quantity of numbers found required and no additional recognition errors introduced.
The Solution
Performance improvementWe used several ways to increase performance of the PNR tool, here are some examples:
- Removed excessive copying of objects
Where possible constant references are used instead of making object copy, in most cases copy constructors and assignment operators were made private to avoid unexpected object copy. - Avoid double calculation of same value
Where possible store pre-calculated value in temporary variable or private class member to avoid calculating it several times. Most common examples here are loop border condition and constant array sizes. - Algorithmic optimization
Some linear searches were replaced with binary searches on ordered arrays or on tree-like structures
To improve application stability the following things were done:
- Exception handling
All external interface function implementations were enclosed by try-catch blocks to avoid any internal exceptions to go out from PNR code. - Control and minimize dynamic memory usage
Where it is possible dynamic memory usage was removed. Where its usage is required then more efforts were done to control dynamic memory better and avoid leaks. - Object life-time control
Every object now has an owner and controlled lifetime. When object can be used in many places and it is impossible to have single owner, reference counters are used to control object lifetime. - "Black-box" concept
In PNR implementation, all class members made private allowing only operations via class methods to disallow all "unwanted" class member changes from other parts of PNR. - Synchronization
Thread synchronizations were added to avoid changing objects from several threads at the same time.
Tools and Technologies
MS Visual Studio, 2008, WiX, Python, STL, Boost, COM/ActiveX, POCO, XUL, WTL, XML.Related links
Project description on Softage website:http://www.softage.ru/projects/skype-code-refactoring/
Skype website: http://www.skype.com/intl/en/home
Post Your Story, Tell All About Your Success!
If you want the story of your company to appear on the portal please fill out this form and send it to [email protected]. We would also like you to leave contact information (name, e-mail, phone) of a person who is responsible for filling the form to clarify any questions, which could appear.
Available Success Stories From Companies:
Disclaimer
All information contained in this Section is owned by RUSSOFT.org and its Participants and is protected by Russian and international copyright laws. Any reproduction or republication of all or part of this Section has to remain intact and include a notice on the copyright of RUSSOFT.org or the Participants, as applicable.
While the information of this Section has been presented with all due care, RUSSOFT.org does not warrant the accuracy, completeness, usefulness and truth of Section’s information, links and logos derived from third parties. RUSSOFT.org is not liable for any loss or damage occurring from the use of this Section’s materials.






