Fastest FileLoading Techniquie for simple VB
In All the other methods I've tried, I run into a barrier(around 170K+) where loading a file suddenly becomes very slow. I've tried many methods found here and in books, and none have proven to work as well as I was looking for. After a long search I ended up spending some off-time figuring a way out myself. This is what I came up with.(speed increases from 20 seconds@170k to .4 seconds@170k)
AI
Yapay Zeka Özeti: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Kaynak Kod
Public Function LoadBin(Path As String) As String On Error GoTo hell' isn't that where errors belong? Dim nfile As String ' This becomes the file memory Dim i As Long ' temp int i = FreeFile ' Gets a free file number so that this code doesn't interfere with anything else. Open Path For Binary As i ' read the file raw nfile = String(LOF(i), " ") ' create a string in memory that is the size of the file. Get i, , nfile ' in one pass, load the entire file as a single record. Close i ' clean up the mess LoadBin = nfile 'set the return value hell: ' this is where it goes if the code breaks anyway. End Function
Orijinal Yorumlar (3)
Wayback Machine'den kurtarıldı