Skip to content
  • Ahelenia Ziemiańska's avatar
    tools: copyfile: use 64k instead of 512 buffer · 7c665e15
    Ahelenia Ziemiańska authored and Tom Rini's avatar Tom Rini committed
    
    
    This is a trivial but significant optimization:
    mkimage took >200ms (and 49489 writes (of which 49456 512)),
    now it takes  110ms (and   419 writes (of which   386 64k)).
    
    sendfile is much more appropriate for this and is done in one syscall,
    but doesn't bring any significant speedups over 64k r/w
    at the 13M size ranges, so there's no need to introduce
    	#if __linux__
    	while((size = sendfile(fd_dst, fd_src, NULL, 128 * 1024 * 1024)) > 0)
    		;
    	if(size != -1) {
    		ret = 0;
    		goto out;
    	}
    	#endif
    
    Also extract the buffer size to a macro.
    
    Signed-off-by: default avatarAhelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
    Reviewed-by: default avatarDragan Simic <dsimic@manjaro.org>
    7c665e15