Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple functions speed up #563

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

yekatkov
Copy link
Contributor

No description provided.

NeoML-maintainer and others added 25 commits January 14, 2021 23:36
vectorFill replaced by std::fill_n
dataCopy replaced by std::copy

Signed-off-by: Yury Katkov <[email protected]>
Signed-off-by: Yury Katkov <[email protected]>
Extract common code for simple math primitives.

Signed-off-by: Yury Katkov <[email protected]>

sseSize -= 4;
if( vectorSize > 0 ) {
memcpy( dst, src, vectorSize * sizeof( T ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Какая-то непоследовательность. Если std::fill_n, тогда std::copy_n, зачем memcpy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, согласен. copy_n будет лучше смотреться

CGenerator& genInst = gens[static_cast< size_t >( P )];
genInst.lock.lock();
if( genInst.gen.getSize() == 0 ) {
initPrimitive<P>();
}
genInst.lock.unlock();
return genInst.gen.getCode();
return reinterpret_cast<void*>( const_cast<uint8_t*>( genInst.gen.getCode() ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хватило бы static_cast, а reinterpret_cast - перебор.

Fix PR comment.

Signed-off-by: Yury Katkov <[email protected]>
Signed-off-by: Yury Katkov <[email protected]>
@favorart favorart added the performance Changes of performance improvements only label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Changes of performance improvements only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants