UIImageJPEGRepresentation& UIImagePNGRepresentation性能缓慢

时间:2016-02-14 11:13:38

标签: image performance nsdata

我在UIImageJPEGRepresentation& amp; UIImagePNGRepresentation。那些时间是相同的形象:

void CMainFrame::OnBtnUpdateApp() {

    SHELLEXECUTEINFO    lpExecInfo;
    DWORD               dwExitCode;
    HINSTANCE           hProcess = 0;
    BOOL                bResult;



    ZeroMemory(&lpExecInfo,sizeof(lpExecInfo));
    lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
    lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
    lpExecInfo.hwnd = GetSafeHwnd();
    lpExecInfo.lpVerb = _T("open");
    lpExecInfo.lpFile = _T("Update.exe");
    lpExecInfo.lpParameters = _T("");
    lpExecInfo.lpDirectory = _T("");
    lpExecInfo.nShow = SW_SHOWNORMAL;
    lpExecInfo.hInstApp = NULL;
    lpExecInfo.hProcess = hProcess;

    bResult = ShellExecuteEx(&lpExecInfo);

    if(bResult) { 


         WaitForSingleObject( lpExecInfo.hProcess, INFINITE );

         if (!GetExitCodeProcess(lpExecInfo.hProcess, &dwExitCode)) {
                //failed to terminate normally   
         }

         CloseHandle(lpExecInfo.hProcess);

    } else {

        //failed to execute the exe file
    }


}

当我在彼此之后运行两种方法时,它花了

 1. It takes 130ms for the JPEG
 2. It takes 271ms for the PNG.a

和另一种方式花了

 3. 273ms for the PNG and then 49ms for JPEG

第二次通话花费的时间更短!

我的问题是我需要将条目保存到核心数据,但我有多个图像,因此可能需要花费大量时间来保存所有图像。

有没有更快的方法将图像转换为NSData?

0 个答案:

没有答案