Skip to content
  • benjamin@webkit.org's avatar
    Unify Number to StringImpl conversion · 2cc62bc6
    benjamin@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=94879
    
    Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-08-24
    Reviewed by Geoffrey Garen.
    
    Source/JavaScriptCore: 
    
    * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
    * runtime/UString.cpp:
    * runtime/UString.h:
    (JSC::UString::number):
    Update UString to directly use the common NumberToString implementation.
    
    Source/WebKit2: 
    
    * win/WebKit2.def: Update the exported symbols.
    
    Source/WTF: 
    
    Previously, UString::number() and String::number() used different implementations.
    
    WTF::String::number() was simply forwarding to String::format().
    UString::number() had an optimized version of the conversion.
    
    This patch replace both implementation by a new version, faster than the two previous versions.
    
    The new functions numberToStringImpl improvements are:
    -about 3 times faster than String::number().
    -14% faster than UString::number() on signed numbers.
    -9% faster than UString::number() on unsigned numbers.
    
    * GNUmakefile.list.am:
    * WTF.gypi:
    * WTF.pro:
    * WTF.vcproj/WTF.vcproj:
    * WTF.xcodeproj/project.pbxproj:
    * wtf/CMakeLists.txt:
    * wtf/text/IntegerToStringConversion.cpp: Added.
    (WTF::numberToStringImplSigned):
    (WTF::numberToStringImpl):
    (WTF::numberToStringImplUnsigned):
    * wtf/text/IntegerToStringConversion.h: Added.
    * wtf/text/WTFString.cpp:
    (WTF::String::format):
    * wtf/text/WTFString.h:
    (WTF::String::number):
    
    Tools: 
    
    Add testing for the new IntegerToStringConversion.
    
    * TestWebKitAPI/CMakeLists.txt:
    * TestWebKitAPI/GNUmakefile.am:
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126658 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    2cc62bc6