• Stephan Bergmann's avatar
    Stick to a single O[U]String hash function · 042725a5
    Stephan Bergmann yazdı
    8f8bc0dc "Move string hash function into String
    class" had introduced a new getHash64 that, besides returning sal_uInt64 instead
    of just sal_Int32, didn't do sampling of only a handful of characters, but
    always computed the hash over all characters (as the usage in SfxItemSet and
    SdPage appears to require for either performance or approximated correctness).
    
    However, it would be advantageous to keep the stable URE interface as small as
    possible.  Now, O(1) sampling was apparently considered state of the art when
    the rtl string classes were first created, closely copying java.lang.String,
    which at that time demanded sampling for hashCode(), too---but never sampling
    more than 15 characters, with the obvious (in hindsight, at least) performance
    catastrophes, so they changed it to O(n) somewhere along the way.
    
    Based on that, this commit changes the existing hash functions to not do
    sampling any more, and removes the newly introduced -64 variants again.  (Where
    the extended value range of sal_uInt64 compared to sal_Int32 was hopefully not
    vital to the existing uses.)
    
    The old implementation used sampling only for strings of length >= 256, so I did
    a "make check" build with an instrumented hash function that flagged all uses
    with inputs of length >= 256, and grepped workdir/{Cppunit,Junit,Python}Test for
    hits.  Of the 2849 hits encountered, 2845 where in the range from 256 to 295
    characters, and only the remaining four where of 2472 characters.  Those four
    were from CppunitTest_sc_subsequent_filters_test, importing long text into a
    cell, causing ScDocumentImport::setStringCell to call
    svl::SharedStringPool::intern, which internally uses an unordered_set.  These
    results appear to justify the change.
    
    Change-Id: I78fcc3b0f07389bdf36a21701b95a1ff0a0d970f
    042725a5
Adı
Son kayıt (commit)
Son güncelleme
..
android Loading commit data...
cpprt Loading commit data...
cppunittester Loading commit data...
inc Loading commit data...
osl Loading commit data...
qa Loading commit data...
rtl Loading commit data...
systools/win32/uwinapi Loading commit data...
test Loading commit data...
textenc Loading commit data...
util Loading commit data...
workben Loading commit data...
CppunitTest_Module_DLL.mk Loading commit data...
CppunitTest_sal_bytesequence.mk Loading commit data...
CppunitTest_sal_osl_condition.mk Loading commit data...
CppunitTest_sal_osl_file.mk Loading commit data...
CppunitTest_sal_osl_getsystempathfromfileurl.mk Loading commit data...
CppunitTest_sal_osl_module.mk Loading commit data...
CppunitTest_sal_osl_mutex.mk Loading commit data...
CppunitTest_sal_osl_old_test_file.mk Loading commit data...
CppunitTest_sal_osl_pipe.mk Loading commit data...
CppunitTest_sal_osl_process.mk Loading commit data...
CppunitTest_sal_osl_profile.mk Loading commit data...
CppunitTest_sal_osl_security.mk Loading commit data...
CppunitTest_sal_osl_setthreadname.mk Loading commit data...
CppunitTest_sal_osl_thread.mk Loading commit data...
CppunitTest_sal_rtl_alloc.mk Loading commit data...
CppunitTest_sal_rtl_bootstrap.mk Loading commit data...
CppunitTest_sal_rtl_cipher.mk Loading commit data...
CppunitTest_sal_rtl_crc32.mk Loading commit data...
CppunitTest_sal_rtl_doublelock.mk Loading commit data...
CppunitTest_sal_rtl_locale.mk Loading commit data...
CppunitTest_sal_rtl_math.mk Loading commit data...
CppunitTest_sal_rtl_ostringbuffer.mk Loading commit data...
CppunitTest_sal_rtl_oustring.mk Loading commit data...
CppunitTest_sal_rtl_oustringbuffer.mk Loading commit data...
CppunitTest_sal_rtl_process.mk Loading commit data...
CppunitTest_sal_rtl_strings.mk Loading commit data...
CppunitTest_sal_rtl_textenc.mk Loading commit data...
CppunitTest_sal_rtl_uri.mk Loading commit data...
CppunitTest_sal_rtl_uuid.mk Loading commit data...
CppunitTest_sal_tcwf.mk Loading commit data...
CppunitTest_sal_types.mk Loading commit data...
Executable_cppunittester.mk Loading commit data...
Executable_osl_process_child.mk Loading commit data...
Library_lo-bootstrap.mk Loading commit data...
Library_sal.mk Loading commit data...
Library_sal_textenc.mk Loading commit data...
Library_uwinapi.mk Loading commit data...
Makefile Loading commit data...
Module_sal.mk Loading commit data...
README Loading commit data...
StaticLibrary_salcpprt.mk Loading commit data...