第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

緩沖文件(用于更快的磁盤(pán)訪問(wèn))

緩沖文件(用于更快的磁盤(pán)訪問(wèn))

緩沖文件(用于更快的磁盤(pán)訪問(wèn))我正在處理大文件,直接寫(xiě)入磁盤(pán)很慢。因?yàn)槲募艽?,我無(wú)法在TMemoryStream中加載它。TFileStream沒(méi)有緩沖,所以我想知道是否有一個(gè)可以提供緩沖流的自定義庫(kù),或者我是否應(yīng)該只依賴(lài)OS提供的緩沖。OS緩沖是否可靠?我的意思是如果緩存已滿,可以從緩存中刷新舊文件(我的)以便為新文件騰出空間。我的文件在GB范圍內(nèi)。它包含數(shù)百萬(wàn)條記錄。不幸的是,記錄不是固定大小。所以,我必須做數(shù)百萬(wàn)的讀數(shù)(4到500字節(jié)之間)。閱讀(和寫(xiě)作)是順序的。我不會(huì)上下跳進(jìn)文件(我認(rèn)為這是緩沖的理想選擇)。最后,我必須將這樣的文件寫(xiě)回磁盤(pán)(再次寫(xiě)入數(shù)百萬(wàn)的小寫(xiě))。對(duì)David Heffernan贊不絕口!David提供了一段很棒的代碼,提供緩沖磁盤(pán)訪問(wèn)。人們你必須擁有他的BufferedFileStream!這是黃金。并且不要忘記upvote。謝謝大衛(wèi)。   Speed tests:      Input file: 317MB.SFF      Delphi stream: 9.84sec      David's stream: 2.05sec     ______________________________________    More tests:      Input file: input2_700MB.txt      Lines: 19 millions      Compiler optimization: ON      I/O check: On      FastMM: release mode     **HDD**         Reading: **linear** (ReadLine) (PS: multiply time with 10)             We see clear performance drop at 8KB. Recommended 16 or 32KB         Time: 618 ms  Cache size: 64KB.         Time: 622 ms  Cache size: 128KB.         Time: 622 ms  Cache size: 24KB.         Time: 622 ms  Cache size: 32KB.         Time: 622 ms  Cache size: 64KB.         Time: 624 ms  Cache size: 256KB.         Time: 625 ms  Cache size: 18KB.         Time: 626 ms  Cache size: 26KB.         Time: 626 ms  Cache size: 1024KB.         Time: 626 ms  Cache size: 16KB.         Time: 628 ms  Cache size: 42KB.         Time: 644 ms  Cache size: 8KB.      <--- no difference until 8K         Time: 664 ms  Cache size: 4KB.         Time: 705 ms  Cache size: 2KB.         Time: 791 ms  Cache size: 1KB.         Time: 795 ms  Cache size: 1KB.       **SSD**       We see a small improvement as we go towards higher buffers. Recommended 16 or 32KB         Time: 610 ms  Cache size: 128KB.         Time: 611 ms  Cache size: 256KB.         Time: 614 ms  Cache size: 32KB.         Time: 623 ms  Cache size: 16KB.         Time: 625 ms  Cache size: 66KB.         Time: 639 ms  Cache size: 8KB.       <--- definitively not good with 8K         Time: 660 ms  Cache size: 4KB.      ______
查看完整描述

3 回答

?
智慧大石

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超3個(gè)贊

TFileStream類(lèi)內(nèi)部使用CreateFile,它總是使用緩沖區(qū)來(lái)管理文件,除非你指定的功能FILE_FLAG_NO_BUFFERING標(biāo)志(注意這直接使用TFileStream的,你不能指定該標(biāo)志)。有關(guān)更多信息,您可以查看這些鏈接

您也可以嘗試使用Primoz Gabrijelcic TGpHugeFileStreamGpHugeFile單元。


查看完整回答
反對(duì) 回復(fù) 2019-08-26
  • 3 回答
  • 0 關(guān)注
  • 673 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)