Skip to content

Instantly share code, notes, and snippets.

@bstaletic
bstaletic / master
Last active June 12, 2021 07:31
parallel algorithms
CandidatesWithCommonPrefix/1/0 750
CandidatesWithCommonPrefix/16/0 4631
CandidatesWithCommonPrefix/256/0 86416
CandidatesWithCommonPrefix/4096/0 1404064
CandidatesWithCommonPrefix/65536/0 31375124
CandidatesWithCommonPrefix/1/10 713
CandidatesWithCommonPrefix/16/10 4131
CandidatesWithCommonPrefix/256/10 43568
CandidatesWithCommonPrefix/4096/10 689512
CandidatesWithCommonPrefix/65536/10 16244392
@bstaletic
bstaletic / bench.md
Created June 4, 2021 16:32
digit counting benchmark

Besides what /u/adnukator said:

  1. Instead of your nested loop, tell the benchmark framework what arguments you need.
  2. Lookup tables perform better on monotonically increasing numbers. I think a better comparison would be a randomized array of values from which to pick arguments.

Here's what the benchmark looks like:

#include <array>
#include <algorithm>
#include 
@bstaletic
bstaletic / nldev.log
Created May 27, 2021 10:27
nldev probing non-existent modules
2021-05-27 12:00:56.127492474 modprobe: FATAL: Module platform:alarmtimer not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.155315986 modprobe: FATAL: Module platform:reg-dummy not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.160477620 modprobe: FATAL: Module acpi:PNP0C0D: not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.161431198 modprobe: FATAL: Module acpi:PNP0C0A: not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.164979828 modprobe: FATAL: Module acpi:ACPI0003: not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.167843042 modprobe: FATAL: Module platform:dell-smbios not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.170110562 modprobe: FATAL: Module platform:dcdbas not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56.172949053 modprobe: FATAL: Module platform:platform-framebuffer not found in directory /lib/modules/5.12.6-artix1-1
2021-05-27 12:00:56
@bstaletic
bstaletic / data
Last active May 18, 2021 09:15
Clangd segfault investigation
Content-Length: 1232
{"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"documentationFormat":["plaintext","markdown"]},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"documentSymbol":{"hierarchicalDocumentSymbolSupport":false,"labelSupport":false,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"hover":{"contentFormat":["plaintext","markdown"]},"signatureHelp":{"signatureInformation":{"documentationFormat":["plaintext","markdown"],"parameterInformation":{"labelOffsetSupport":true}}},"synchronization":{"didSave":true}},"workspace":{"applyEdit":true,"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,
diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt
index a7d47bf7..168144cc 100644
--- a/cpp/ycm/CMakeLists.txt
+++ b/cpp/ycm/CMakeLists.txt
@@ -307,11 +307,27 @@ else()
message( FATAL_ERROR "Unknown compiler - C++17 filesystem library missing" )
endif()
+# Check if Abseil supports this environment
+file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/main.cpp "#include <absl/base/policy_checks.h>\nint main() {}" )
SCRIPT /usr/share/vim/vim82/ftplugin/python.vim
Sourced 1 time
Total time: 0.000708
Self time: 0.000708
count total (s) self (s)
" Vim filetype plugin file
" Language: python
" Maintainer: Tom Picton <tom@tompicton.co.uk>
" Previous Maintainer: James Sully <sullyj3@gmail.com>
------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------------------------------------------------------------------------
IdentifierCompleterFixture/CandidatesWithCommonPrefix/1/0 570 ns 569 ns 1233659
IdentifierCompleterFixture/CandidatesWithCommonPrefix/16/0 4160 ns 4157 ns 169346
IdentifierCompleterFixture/CandidatesWithCommonPrefix/256/0 80560 ns 80501 ns 8793
IdentifierCompleterFixture/CandidatesWithCommonPrefix/4096/0 883403 ns 882515 ns 784
IdentifierCompleterFixture/CandidatesWithCommonPrefix/65536/0 16329117 ns 16276601 ns 42
IdentifierCompleterFixture/CandidatesWithCommonPrefix_Bi
@bstaletic
bstaletic / valgrind-import-numpy.log
Last active January 31, 2021 17:28
Numpy leaks on import
==24972== Memcheck, a memory error detector
==24972== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==24972== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==24972== Command: python3.9-dbg -c import\ numpy;\ print(numpy.__version__)
==24972==
1.20.0
==24972==
==24972== HEAP SUMMARY:
==24972== in use at exit: 3,340,248 bytes in 20,455 blocks
==24972== total heap usage: 316,625 allocs, 296,170 frees, 47,680,096 bytes allocated
@bstaletic
bstaletic / YCM.log
Last active December 3, 2020 11:45
logs...
2020-12-03 12:43:29,886 - DEBUG - GET b'http://127.0.0.1:49813/ready' (None)
{'content-type': 'application/json', 'x-ycm-hmac': b'7V/oVwvrialI/7bgEjjDAsu1Ix7gYeJxgWG2kIEyaiU='}
2020-12-03 12:43:29,977 - DEBUG - RX: <Response [200]>
true
2020-12-03 12:43:29,978 - DEBUG - GET b'http://127.0.0.1:49813/signature_help_available' ({'subserver': 'cpp'})
{'content-type': 'application/json', 'x-ycm-hmac': b'tl3HNVpthje1kIGfOnJ0lfgmFtu7Un0EL3H7JtnJqLc='}
2020-12-03 12:43:30,058 - DEBUG - POST b'http://127.0.0.1:49813/event_notification'
{'content-type': 'application/json', 'x-ycm-hmac': b'r0oL36K60tWxZfFXGh3ZiGiRJIEDrzHP2NjJD2pYtd8='}
b'{"filepath": "/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/bar.cpp", "line_num": 1, "column_num": 1, "working_dir": "/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe", "file_data": {"/home/bstaletic/.vim/pack/bundle/start/YouCompleteMe/bar.cpp": {"contents": "\\n", "filetypes": ["cpp"]}}, "ultisnips_snippets": [{"trigger": "ld", "description": ""}, {"trigger": "def", "descri
@bstaletic
bstaletic / YCM client logs
Created November 20, 2020 14:07
Example of C# logs
2020-11-20 15:04:48,082 - DEBUG - GET b'http://127.0.0.1:37387/ready' (None)
{'content-type': 'application/json', 'x-ycm-hmac': b'toH/c+m5V0zqogMQHt7DMb0xLcgbSErbDw64wIPBgrg='}
2020-11-20 15:04:48,236 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=37387): Max retries exceeded with url: /ready (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7d979f280>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-11-20 15:04:48,336 - DEBUG - GET b'http://127.0.0.1:37387/ready' (None)
{'content-type': 'application/json', 'x-ycm-hmac': b'toH/c+m5V0zqogMQHt7DMb0xLcgbSErbDw64wIPBgrg='}
2020-11-20 15:04:48,338 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=37387): Max retries exceeded with url: /ready (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7d979fac0>: Failed to establish a new connection: [Errno 111] Connection refused'))
2020-11-20 15:04:48,438 - DEBUG - GET b'http://127.0.0.1:37387/ready' (None)
{'content-type': 'a