Skip to content

Commit 86c82a5

Browse files
ldemaillyFacebook Github Bot
authored andcommitted
avoid crashes, faster varint, fewer dependencies
Summary: wdt could corrupt memory on bad input re speed: buck build mode/opt and : [19:27 devbig650.prn1:fbcode(sg2)]$ ./buck-out/gen/wdt/test_encdeci64_perf ============================================================================ wdt/test/test_encdeci64_perf.cpp relative time/iter iters/s ============================================================================ BM_encodeDecodeI64(0) 10.67ns 93.73M BM_encodeDecodeI64(m10k) 3.67ns 272.66M BM_encodeDecodeI64(10000) 3.67ns 272.66M BM_encodeDecodeI64(m1k) 2.67ns 374.93M BM_encodeDecodeI64(1000) 2.67ns 374.93M BM_encodeDecodeI64(m100) 2.67ns 374.93M BM_encodeDecodeI64(100) 2.77ns 360.85M BM_encodeDecodeI64(m10) 2.05ns 488.55M BM_encodeDecodeI64(10) 2.05ns 488.34M BM_encodeDecodeI64_vi(0) 13.56ns 73.73M BM_encodeDecodeI64_vi(m10k) 7.33ns 136.34M BM_encodeDecodeI64_vi(10000) 7.33ns 136.34M BM_encodeDecodeI64_vi(m1k) 5.00ns 199.97M BM_encodeDecodeI64_vi(1000) 5.00ns 199.97M BM_encodeDecodeI64_vi(m100) 5.00ns 199.97M BM_encodeDecodeI64_vi(100) 5.00ns 199.97M BM_encodeDecodeI64_vi(m10) 2.38ns 420.09M BM_encodeDecodeI64_vi(10) 2.38ns 420.53M BM_encodeDecodeI64_str(0) 44.63ns 22.41M BM_encodeDecodeI64_str(m10k) 18.67ns 53.55M BM_encodeDecodeI64_str(10000) 18.69ns 53.50M BM_encodeDecodeI64_str(m1k) 16.08ns 62.20M BM_encodeDecodeI64_str(1000) 16.08ns 62.19M BM_encodeDecodeI64_str(m100) 16.08ns 62.20M BM_encodeDecodeI64_str(100) 16.08ns 62.20M BM_encodeDecodeI64_str(m10) 13.38ns 74.74M BM_encodeDecodeI64_str(10) 13.38ns 74.73M BM_encodeDecodeI64_vi_str(0) 31.10ns 32.16M BM_encodeDecodeI64_vi_str(m10k) 22.70ns 44.04M BM_encodeDecodeI64_vi_str(10000) 22.72ns 44.02M BM_encodeDecodeI64_vi_str(m1k) 21.37ns 46.80M BM_encodeDecodeI64_vi_str(1000) 21.37ns 46.79M BM_encodeDecodeI64_vi_str(m100) 21.37ns 46.80M BM_encodeDecodeI64_vi_str(100) 21.35ns 46.84M BM_encodeDecodeI64_vi_str(m10) 20.21ns 49.47M BM_encodeDecodeI64_vi_str(10) 20.09ns 49.78M ============================================================================ _vi is the folly varint version, without _vi is the new, faster, more compact one Reviewed By: uddipta Differential Revision: D4225139 fbshipit-source-id: d85683fe70416738208883e86a6dd5f6db2d05b2
1 parent 5db93b8 commit 86c82a5

26 files changed

+1382
-522
lines changed

ByteSource.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ struct SourceMetaData {
3030
/// relative pathname
3131
std::string relPath;
3232
/**
33-
* sequence number associated with the file. Sequence number
33+
* Sequence number associated with the file. Sequence number
3434
* represents the order in which files were first added to the queue.
3535
* This is a file level identifier. It is same for blocks belonging
3636
* to the same file. This is efficient while using in sets. Instead
3737
* of using full path of the file, we can use this to identify the
38-
* file.
38+
* file. First valid sequence id is 1
3939
*/
4040
int64_t seqId{0};
4141
/// size of the entire source

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cmake_minimum_required(VERSION 3.2)
2222
# There is no C per se in WDT but if you use CXX only here many checks fail
2323
# Version is Major.Minor.YYMMDDX for up to 10 releases per day (X from 0 to 9)
2424
# Minor currently is also the protocol version - has to match with Protocol.cpp
25-
project("WDT" LANGUAGES C CXX VERSION 1.26.1611290)
25+
project("WDT" LANGUAGES C CXX VERSION 1.27.1611290)
2626

2727
# On MacOS this requires the latest (master) CMake (and/or CMake 3.1.1/3.2)
2828
# WDT itself works fine with C++11 (gcc 4.8 for instance) but more recent folly
@@ -343,6 +343,10 @@ if (BUILD_TESTING)
343343
target_link_libraries(protocol_test wdt4tests)
344344
add_test(NAME AllTestsInProtocolTest COMMAND protocol_test)
345345

346+
add_executable(test_encdeci64_func test/test_encdeci64_func.cpp)
347+
target_link_libraries(test_encdeci64_func wdt4tests)
348+
add_test(NAME test_encdeci64_func COMMAND test_encdeci64_func)
349+
346350
add_executable(resource_controller_test test/WdtResourceControllerTest.cpp)
347351
target_link_libraries(resource_controller_test wdt4tests)
348352
add_test(NAME ResourceControllerTests COMMAND resource_controller_test)

0 commit comments

Comments
 (0)