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

memcpy optimize copy_cut_border/copy_make_boder #179

Merged
merged 4 commits into from
Nov 2, 2017
Merged

memcpy optimize copy_cut_border/copy_make_boder #179

merged 4 commits into from
Nov 2, 2017

Conversation

LittlePeng
Copy link
Contributor

No description provided.

@LittlePeng
Copy link
Contributor Author

LittlePeng commented Nov 2, 2017

android 6.0 测试脚本 copy_cut_borderv2 为memcpy版本:

static void bench_cut_border(int size, int iteration, char* comment){
    ncnn::Mat src = ncnn::Mat(size, size, 3);
    ncnn::Mat dst;
    bench_start();
    for(int i=0; i<iteration; i++){
        copy_cut_borderv1(src, dst, 1, 1, 1, 1);
    }
    bench_end(comment);
    
    bench_start();
    for(int i=0; i<iteration; i++){
        copy_cut_borderv2(src, dst, 1, 1, 1, 1);
    }
    bench_end(comment);
}

bench_cut_border(5, 10000, "3*5*5");
bench_cut_border(10, 10000, "3*10*10");
bench_cut_border(14, 10000, "3*14*14");
bench_cut_border(20, 10000, "3*20*20");
bench_cut_border(50, 10000, "3*50*50");
bench_cut_border(250, 5000, "3*250*250");
bench_cut_border(500, 1000, "3*500*500");
bench_cut_border(1000, 500, "3*1000*1000");

结果:


4.62ms   3*5*5
5.40ms   3*5*5
9.38ms   3*10*10
11.04ms   3*10*10
20.10ms   3*14*14
16.83ms   3*14*14
30.01ms   3*20*20
23.47ms   3*20*20
163.74ms   3*50*50
90.66ms   3*50*50
5135.47ms   3*250*250
4193.02ms   3*250*250
4396.05ms   3*500*500
3623.97ms   3*500*500
8779.94ms   3*1000*1000
7144.28ms   3*1000*1000

memcpy 从一次copy 12个float 开始速度有优势

@nihui nihui merged commit a86cc8f into Tencent:master Nov 2, 2017
ghimiredhikura pushed a commit to ghimiredhikura/NCNNSFD that referenced this pull request Jul 26, 2020
* memcpy optimize copy_cut_border/copy_make_boder

* copy small border memcpy may slow

* remove unuse line

* code style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants