Skip to content

Instantly share code, notes, and snippets.

@bstaletic
bstaletic / ycm_core_size_linux
Last active June 29, 2018 05:59
ycm_core size difference
$ size -A -d ycm_core.so
ycm_core.so :
section size addr
.note.gnu.build-id 36 456
.gnu.hash 1876 496
.dynsym 14328 2376
.dynstr 28268 16704
.gnu.version 1194 44972
.gnu.version_r 320 46168
.rela.dyn 12771312 46488
@bstaletic
bstaletic / ycmd_tcmalloc_bench
Last active July 2, 2018 19:58
ycmd allocator benchmarks
=====================================================================================================================
Current
=====================================================================================================================
---------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1/0 905 ns 905 ns 685906
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16/0 4940 ns 4940 ns 118304
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256/0 103261 ns 103245 ns 6356
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096/0
@bstaletic
bstaletic / linux
Created July 14, 2018 07:08
Section sizes of ycm_core.so
=======================================
Current
=======================================
/home/bstaletic/Temp/ycmd/ycm_core.so :
section size addr
.gnu.hash 1880 400
.dynsym 14328 2280
.dynstr 28773 16608
.gnu.version 1194 45382
.gnu.version_r 320 46576
count total (s) self (s) function
21 0.042445 0.009410 traces#init()
4 0.025162 0.001024 <SNR>74_OnTextChangedInsertMode()
21 0.024647 0.002286 <SNR>79_evaluate_cmdl()
4 0.016826 0.013068 <SNR>74_InvokeCompletion()
6 0.015522 0.000492 gitgutter#process_buffer()
2 0.013982 0.001200 gitgutter#diff#run_diff()
13 0.011894 <SNR>23_Highlight_Matching_Pair()
1 0.010194 0.006844 <SNR>74_OnInsertLeave()
21 0.009535 0.001707 <SNR>79_parse_command()
@bstaletic
bstaletic / pybind11_valgrind
Created August 1, 2018 14:51
vlagrind analysis
==4673== 284 bytes in 5 blocks are possibly lost in loss record 3,454 of 3,914
==4673== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==4673== by 0x643C612: PyUnicode_New (unicodeobject.c:1293)
==4673== by 0x6463C73: _PyUnicodeWriter_PrepareInternal (unicodeobject.c:13454)
==4673== by 0x6465FFF: PyUnicode_DecodeUTF8Stateful (unicodeobject.c:4819)
==4673== by 0x640BD03: PyDict_SetItemString (dictobject.c:3285)
==4673== by 0x64C80D3: PyImport_Cleanup (import.c:426)
==4673== by 0x64D765E: Py_FinalizeEx (pylifecycle.c:1181)
==4673== by 0x403894: pybind11::finalize_interpreter() (in /home/bstaletic/Temp/ycmd/build/ycm/tests/ycm_core_tests)
==4673== by 0x3783C6: main (in /home/bstaletic/Temp/ycmd/build/ycm/tests/ycm_core_tests)
@bstaletic
bstaletic / Python3.5 non debug
Last active September 6, 2018 02:27
r/python
==2096== Memcheck, a memory error detector
==2096== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2096== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==2096== Command: ./a.out
==2096==
==2096== Conditional jump or move depends on uninitialised value(s)
==2096== at 0x54279E0: __wcsnlen_sse4_1 (strlen.S:147)
==2096== by 0x5414EC1: wcsrtombs (wcsrtombs.c:104)
==2096== by 0x539AB20: wcstombs (wcstombs.c:34)
==2096== by 0x4FDE9AB: wcstombs (stdlib.h:154)
@bstaletic
bstaletic / const std::string&
Created October 2, 2018 17:39
string_view vs const std::string&
---------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1/0 823 ns 823 ns 793146
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16/0 4815 ns 4815 ns 135540
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256/0 104214 ns 104213 ns 6618
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096/0 2004064 ns 2004023 ns 295
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536/0 45311469 ns 45310567 ns 14
IdentifierCompleterFixture_BigO 43.
@bstaletic
bstaletic / CodePoint.diff
Last active October 10, 2018 18:17
CodePointArray
diff --git a/cpp/ycm/CodePoint.cpp b/cpp/ycm/CodePoint.cpp
index 5e0c2673..651c0743 100644
--- a/cpp/ycm/CodePoint.cpp
+++ b/cpp/ycm/CodePoint.cpp
@@ -52,15 +52,25 @@ const RawCodePoint FindCodePoint( const char *text ) {
// Do a binary search on the array of code points to find the raw code point
// corresponding to the text. If no code point is found, return the default
// raw code point for that text.
- auto first = code_points.begin();
- size_t count = code_points.size();
@bstaletic
bstaletic / gist:7d3e31db7fc8d40a12787fab09ff092f
Last active March 16, 2019 10:40
Hash table ycmd benchmark
Master
====================================================================================================================
Benchmark Time CPU Iterations
---------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1/0 963 ns 963 ns 715984
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16/0 4847 ns 4845 ns 141723
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256/0 99721 ns 99649 ns 7083
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096/0 1837649 ns 1835977 ns 277
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536/0 52351028 ns 52209061 ns 10
IdentifierCompleterFixture_BigO
@bstaletic
bstaletic / regex_benchmark
Last active January 18, 2019 20:33
regex benchmark
====================================================================================================================
CTRE
====================================================================================================================
Short lines
--------------------------------------------------------------------------------------------------------------------
IdentifierUtilsFixture/ExtractIdentifiersFromTagsFileBench/1 13942 ns 13880 ns 50167
IdentifierUtilsFixture/ExtractIdentifiersFromTagsFileBench/16 90985 ns 90820 ns 7750
IdentifierUtilsFixture/ExtractIdentifiersFromTagsFileBench/256 1276019 ns 1274500 ns 549
IdentifierUtilsFixture/ExtractIdentifiersFromTagsFileBench/4096 20341581 ns 20320151 ns 34
IdentifierUtilsFixture/ExtractIdentifiersFromTagsFileBench/65536 321841967 ns 321586870 ns 2