Open
Conversation
springfieldking
commented
Apr 27, 2022
| int first = 0; | ||
| size_t maxlen = 0; | ||
|
|
||
| std::vector<row_type> shardVec(totalShards); |
springfieldking
commented
Apr 27, 2022
|
|
||
| fecPacket | ||
| FEC::Decode(byte *data, size_t sz) { | ||
| FEC::Decode(byte *data, size_t sz, uint32_t ts) { |
Author
There was a problem hiding this comment.
fec更贴近协议栈, 通过业务传入时间更合理,避免了协议栈内部调用时间函数,效率更高
springfieldking
commented
Apr 27, 2022
| for (int n=0;n<in->size();n++) { | ||
| (*out)[n] = mulTable[c][(*in)[n]]; | ||
| } | ||
| void galMulSlice(byte c, byte* in, byte* out, int size) { |
Author
There was a problem hiding this comment.
矩阵计算相关 删除了vector和sharedptr的用法, 改为数组操作,效率提升十分明显,仅修改这一处,压测(编译-O2)的耗时就能减少一半
springfieldking
commented
Apr 27, 2022
| // pass down is the first index plus one. | ||
| std::vector<int> v(invalidIndices.begin() + 1, invalidIndices.end()); | ||
| return node->getInvertedMatrix(v, firstIndex + 1); | ||
| // no copy std::vector<int> v(invalidIndices.begin() + 1, invalidIndices.end()); |
springfieldking
commented
Apr 27, 2022
| // SwapRows Exchanges two rows in the matrix. | ||
| int SwapRows(int r1, int r2); | ||
| // IdentityMatrix returns an identity matrix of the given empty. | ||
| class IdentityMatrix : public Matrix { |
Author
There was a problem hiding this comment.
matrix模块做了较大的修改,矩阵模块拆分成类Matrix,单位矩阵和范德蒙矩阵。后两者从Matrix继承并且初始化。矩阵的操作拆分独立的函数,而非成员函数。矩阵的创建通过sharedptr创建,避免之前struct matrix结构复制拷贝。
springfieldking
commented
Apr 27, 2022
|
|
||
| // Get the slice of output buffers. | ||
| std::vector<row_type> output(shards.begin() + m_dataShards, shards.end()); | ||
| static thread_local std::vector<byte*> output(shards.size() - m_dataShards); |
Author
There was a problem hiding this comment.
static thread_local避免重复申请内存,对移动端更友好
springfieldking
commented
Apr 27, 2022
| #include <iostream> | ||
| #include <stdexcept> | ||
| #include "fec.h" | ||
| #include "sess.h" |
Author
There was a problem hiding this comment.
这个依赖有点奇怪,fec依赖sess,只是为了用其时间函数。
Author
There was a problem hiding this comment.
通过sess把时间传递到fec协议栈内更合理。
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.