Skip to content

Instantly share code, notes, and snippets.

@puremourning
Created August 31, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puremourning/a754914cca4f48699a752f2dc75d384d to your computer and use it in GitHub Desktop.
Save puremourning/a754914cca4f48699a752f2dc75d384d to your computer and use it in GitHub Desktop.
DLLDefines benchmark macOS

Master

------------------------------------------------------------------------------------------------------------------
Benchmark                                                                           Time           CPU Iterations
------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1                           776 ns        776 ns     832719
IdentifierCompleterFixture/CandidatesWithCommonPrefix/2                          1328 ns       1328 ns     515487
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4                          2223 ns       2222 ns     309970
IdentifierCompleterFixture/CandidatesWithCommonPrefix/8                          3808 ns       3808 ns     181840
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16                         6824 ns       6823 ns      96052
IdentifierCompleterFixture/CandidatesWithCommonPrefix/32                        13148 ns      13142 ns      50154
IdentifierCompleterFixture/CandidatesWithCommonPrefix/64                        25560 ns      25555 ns      27396
IdentifierCompleterFixture/CandidatesWithCommonPrefix/128                       50621 ns      50598 ns      12402
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256                      122092 ns     122033 ns       5568
IdentifierCompleterFixture/CandidatesWithCommonPrefix/512                      257874 ns     257874 ns       2414
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1024                     576316 ns     576228 ns       1083
IdentifierCompleterFixture/CandidatesWithCommonPrefix/2048                    1197584 ns    1197045 ns        584
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096                    2506638 ns    2506603 ns        282
IdentifierCompleterFixture/CandidatesWithCommonPrefix/8192                    5603172 ns    5602045 ns        112
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16384                  15032006 ns   15031432 ns         44
IdentifierCompleterFixture/CandidatesWithCommonPrefix/32768                  38689992 ns   38689389 ns         18
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536                  87759070 ns   87752625 ns          8
IdentifierCompleterFixture_BigO                                                 81.84 NlgN      81.84 NlgN
IdentifierCompleterFixture_RMS                                                     16 %         16 %
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/1           5060 ns       5005 ns     144819
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/2           7906 ns       7777 ns      89882
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/4          11810 ns      11745 ns      61123
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/8          22301 ns      21815 ns      31862
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/16         36384 ns      36331 ns      19122
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/32         74322 ns      73869 ns       9803
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/64        134059 ns     133963 ns       5066
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/128       263081 ns     262917 ns       2677
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/256       576832 ns     576692 ns       1138
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/512      1258057 ns    1256849 ns        536
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/1024     2696359 ns    2694111 ns        262
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/2048     6441048 ns    6411954 ns        109
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/4096    16001408 ns   15965050 ns         40
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/8192    33499326 ns   33496048 ns         21
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/16384   71644231 ns   71642600 ns         10
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/32768  146818007 ns  146772200 ns          5
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/65536  307162315 ns  306530000 ns          2
PythonSupportFixture_BigO                                                      294.87 NlgN     294.38 NlgN
PythonSupportFixture_RMS                                                            4 %          4 %
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/1             1183 ns       1182 ns     609549
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/2             1965 ns       1964 ns     343690
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/4             3431 ns       3428 ns     201586
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/8             6283 ns       6279 ns     105442
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/16           11542 ns      11531 ns      60237
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/32           22426 ns      22403 ns      31085
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/64           45187 ns      45022 ns      15644
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/128          84340 ns      84324 ns       8120
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/256         170941 ns     170878 ns       4023
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/512         356398 ns     356185 ns       2039
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/1024        704249 ns     703967 ns        850
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/2048       1437794 ns    1437362 ns        500
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/4096       2882466 ns    2882024 ns        248
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/8192       9480919 ns    9469022 ns         91
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/16384     21110607 ns   21050649 ns         37
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/32768     44662222 ns   44551875 ns         16
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/65536     89840997 ns   89774714 ns          7
PythonSupportFixture_BigO                                                       86.78 NlgN      86.68 NlgN
PythonSupportFixture_RMS                                                            7 %          7 %

Patched

BeniMac:ycmd ben$ git diff
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 4cc0e9d4..3019abba 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -102,6 +102,7 @@ if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
     set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics" )
   endif()
 endif()
+set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )

 #############################################################################

diff --git a/cpp/ycm/DLLDefines.h b/cpp/ycm/DLLDefines.h
index 7a328d25..7110245a 100644
--- a/cpp/ycm/DLLDefines.h
+++ b/cpp/ycm/DLLDefines.h
@@ -22,8 +22,8 @@
 // symbol ycm_core_EXPORTS is defined by CMake when building a shared library.
 #if defined( _WIN32 ) && defined( ycm_core_EXPORTS )
 #define YCM_DLL_EXPORT __declspec( dllexport )
-#else
-#define YCM_DLL_EXPORT
+#elif defined( __GNUG__ )
+#define YCM_DLL_EXPORT __attribute__((visibility("default")))
 #endif

 #endif /* end of include guard: DLLDEFINES_H_0IYA3AQ3 */
------------------------------------------------------------------------------------------------------------------
Benchmark                                                                           Time           CPU Iterations
------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1                           748 ns        748 ns     908855
IdentifierCompleterFixture/CandidatesWithCommonPrefix/2                          1251 ns       1251 ns     536579
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4                          2146 ns       2146 ns     329286
IdentifierCompleterFixture/CandidatesWithCommonPrefix/8                          3678 ns       3678 ns     186735
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16                         6710 ns       6707 ns     100672
IdentifierCompleterFixture/CandidatesWithCommonPrefix/32                        13049 ns      13046 ns      50952
IdentifierCompleterFixture/CandidatesWithCommonPrefix/64                        25086 ns      25085 ns      27278
IdentifierCompleterFixture/CandidatesWithCommonPrefix/128                       50410 ns      49964 ns      13806
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256                       98455 ns      98444 ns       5632
IdentifierCompleterFixture/CandidatesWithCommonPrefix/512                      258958 ns     258956 ns       2455
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1024                     568410 ns     568408 ns       1156
IdentifierCompleterFixture/CandidatesWithCommonPrefix/2048                    1177155 ns    1177145 ns        598
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096                    2503683 ns    2503401 ns        287
IdentifierCompleterFixture/CandidatesWithCommonPrefix/8192                    5667726 ns    5666130 ns        123
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16384                  14910853 ns   14910565 ns         46
IdentifierCompleterFixture/CandidatesWithCommonPrefix/32768                  39041861 ns   39029421 ns         19
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536                  84198701 ns   84151000 ns          8
IdentifierCompleterFixture_BigO                                                 79.30 NlgN      79.26 NlgN
IdentifierCompleterFixture_RMS                                                     13 %         13 %
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/1           5059 ns       4995 ns     140487
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/2           7217 ns       7165 ns      99053
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/4          11723 ns      11658 ns      60410
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/8          20285 ns      20208 ns      35280
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/16         36781 ns      36649 ns      19256
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/32         74614 ns      74104 ns       9565
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/64        138242 ns     137605 ns       5122
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/128       279012 ns     277806 ns       2482
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/256       640164 ns     635366 ns       1098
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/512      1239253 ns    1237708 ns        528
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/1024     2616473 ns    2616522 ns        270
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/2048     6124529 ns    6124208 ns        101
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/4096    15231357 ns   15230067 ns         45
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/8192    33082735 ns   33080714 ns         21
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/16384   69866980 ns   69865700 ns         10
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/32768  145715986 ns  145683400 ns          5
PythonSupportFixture/FilterAndSortUnstoredCandidatesWithCommonPrefix/65536  304181226 ns  303684500 ns          2
PythonSupportFixture_BigO                                                      291.91 NlgN     291.53 NlgN
PythonSupportFixture_RMS                                                            3 %          3 %
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/1             1100 ns       1100 ns     620832
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/2             2014 ns       2010 ns     348644
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/4             3578 ns       3566 ns     192978
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/8             6608 ns       6567 ns      98692
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/16           11554 ns      11540 ns      57720
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/32           21881 ns      21876 ns      31396
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/64           41153 ns      41151 ns      16606
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/128          90779 ns      90281 ns       7588
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/256         176018 ns     175711 ns       3717
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/512         356006 ns     355858 ns       1879
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/1024        705085 ns     704992 ns        860
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/2048       1430954 ns    1430869 ns        459
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/4096       2922680 ns    2922642 ns        240
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/8192       7957859 ns    7953171 ns         70
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/16384     19999416 ns   19996200 ns         35
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/32768     41890187 ns   41886312 ns         16
PythonSupportFixture/FilterAndSortStoredCandidatesWithCommonPrefix/65536     91102218 ns   91076286 ns          7
PythonSupportFixture_BigO                                                       86.45 NlgN      86.43 NlgN
PythonSupportFixture_RMS                                                            5 %          5 %
@puremourning
Copy link
Author

Master

-rwxr-xr-x   1 ben  staff   2360144 31 Aug 23:05 ycm_core.so

Patched

-rwxr-xr-x   1 ben  staff   1919912 31 Aug 23:02 ycm_core.so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment