This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Stores the hash of the next 4 bytes and in a single tree-traversal, the | |
hash bucket's binary tree is searched for matches and is re-rooted at the | |
current position. | |
If less than MAX_TREE_COMP_LENGTH data is available, the hash bucket of the | |
current position is searched for matches, but the state of the hash table | |
is not changed, since we can not know the final sorting order of the | |
current (incomplete) sequence. | |
This function must be called with increasing cur_ix positions. */ | |
static BROTLI_INLINE BackwardMatch* FN(StoreAndFindMatches)( | |
HashToBinaryTree* self, const uint8_t* const BROTLI_RESTRICT data, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Stores the hash of the next 4 bytes and re-roots the binary tree at the | |
current sequence, without returning any matches. | |
REQUIRES: ix + MAX_TREE_COMP_LENGTH <= end-of-current-block */ | |
static BROTLI_INLINE void FN(Store)(HasherHandle handle, const uint8_t* data, | |
const size_t mask, const size_t ix) { | |
HashToBinaryTree* self = FN(Self)(handle); | |
/* Maximum distance is window size - 16, see section 9.1. of the spec. */ | |
const size_t max_backward = self->window_mask_ - BROTLI_WINDOW_GAP + 1; | |
FN(StoreAndFindMatches)(self, data, ix, mask, MAX_TREE_COMP_LENGTH, | |
max_backward, NULL, NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static BROTLI_INLINE void FN(StoreRange)(HasherHandle handle, | |
const uint8_t* data, const size_t mask, const size_t ix_start, | |
const size_t ix_end) { | |
size_t i = ix_start; | |
size_t j = ix_start; | |
if (ix_start + 63 <= ix_end) { | |
i = ix_end - 63; | |
} | |
if (ix_start + 512 <= i) { | |
for (; j < i; j += 8) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public run(accessor: ServicesAccessor, editor: ICodeEditor): void { | |
const primaryCursor = editor.getSelection(); | |
const allSelections = editor.getSelections(); | |
const model = editor.getModel(); | |
let rangeAll = []; | |
for(let i = 0; i < allSelections.length;i++){ | |
rangeAll.push(model.getLineContent(allSelections[i].selectionStartLineNumber)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static size_t BrotliParseAsUTF8( | |
int* symbol, const uint8_t* input, size_t size) { | |
/* ASCII */ | |
if ((input[0] & 0x80) == 0) { | |
*symbol = input[0]; | |
if (*symbol > 0) { | |
return 1; | |
} | |
} | |
/* 2-byte UTF8 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BROTLI_BOOL BrotliIsMostlyUTF8( | |
const uint8_t* data, const size_t pos, const size_t mask, | |
const size_t length, const double min_fraction) { | |
size_t size_utf8 = 0; | |
size_t i = 0; | |
while (i < length) { | |
int symbol; | |
size_t bytes_read = | |
BrotliParseAsUTF8(&symbol, &data[(pos + i) & mask], length - i); | |
i += bytes_read; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void BrotliEstimateBitCostsForLiterals(size_t pos, size_t len, size_t mask, | |
const uint8_t* data, float* cost) { | |
if (BrotliIsMostlyUTF8(data, pos, mask, len, kMinUTF8Ratio)) { | |
EstimateBitCostsForLiteralsUTF8(pos, len, mask, data, cost); | |
return; | |
} else { | |
size_t histogram[256] = { 0 }; | |
size_t window_half = 2000; | |
size_t in_window = BROTLI_MIN(size_t, window_half, len); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aarchie: | |
Just with –O2: | |
Run #1 | |
Real 0m49.034s | |
User 0m48.777s | |
Run #2 | |
Real 0m49.065s | |
User 0m48.691s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmark -O2(180mb file): | |
Run#1 | |
Real 0m41.442s | |
User 0m41.200s | |
Run#2 | |
Real 0m41.404s | |
User 0m41.136s | |
AVG: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Aarchie with 180mb file | |
-Just with -O2: | |
real 2m51.523s | |
user 2m51.247s | |
Number of options tested: 1284 | |
Real best time: 2m50.799s (CMAKE_CXX_FLAGS_DEBUG:STRING= -O2 -ftree-loop-distribute-patterns -floop-interchange -ftree-slp-vectorize -fipa-cp-clone) | |
User best time: 2m50.367s (CMAKE_CXX_FLAGS_DEBUG:STRING= -O2 -ftree-loop-distribution -ftree-loop-distribute-patterns -fvect-cost-model -ftree-partial-pre) | |
************************************************************************************************************************** |
NewerOlder