Skip to content

Instantly share code, notes, and snippets.

@9468305
9468305 / vcmi源码编译 windows+cmake+mingw.md
Last active August 5, 2022 07:56
vcmi(魔法门英雄无敌3 - 开源复刻版) 源码编译
@9468305
9468305 / Android md5 blake2 性能优化测试数据.txt
Last active December 26, 2015 20:00
Nexus5奇葩,总是不按常理出牌;在各种情况下,md5p表现都优秀;并行数=4在各种情况下表现稳定;华为荣耀3X应该是8核手机,所以并行数=8时总是最优;目前主流手机是4核为主,因此选择并行数=4的md5算法最好; 后续测试:进行大文件的分段mmap+并行算法测试; 存在争议:究竟瓶颈是cpu还是file io?
Android手机测试数据
测试文件:460MB
源码:见 https://gist.github.com/9468305/97dca7c470ee02a6867c
使用场景:需求源于这里 https://gist.github.com/9468305/fa8f1307ea4738225fca
测试思路:测试mmap,file io buffer read,OpenMP并行数,对各种数据摘要算法,在不同手机上的性能表现进行统计分析
@9468305
9468305 / blake2s_vs_md5.c
Last active December 16, 2015 16:36
blake2与md5算法速度对比测试 包括OpenMP并行加速优化
/* Test case for blake2s blake2sp blake2sp_file vs md5 md5_parallel
* Result: md5_parallel is fastest.
* MD5_File() and MD5_File_Parallel(), see https://github.com/9468305/crsync/blob/master/extra/md5.h
*/
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
@9468305
9468305 / blake2sp_file.c
Last active November 22, 2015 10:31
一个计算文件blake2s信息摘要的并行算法实现
/* A really fast parallel blake2s hash for big file.
*
* Usage: Add this into blake2sp-ref.c
*/
#include <sys/stat.h>
int blake2sp_file( const char *filename, uint8_t *out, uint8_t outlen )
{
memset(out, 0, outlen);
static const size_t buf_len = 8*1024;
struct stat st;

最终实现效果:

  1. 无版本概念,任何本地文件均可增量升级到最新.服务器不用管理多版本
  2. 内存小,100M文件升级时只占用500KB内存.

使用流程:

  1. 制作新版本,上传HTTP File Server.
  2. Client自动计算差异,下载差异,合并差异.
  3. done!

#0.起源