LFCavalcanti
Is there a way to read big files using something like .seek but with ending position as well?
The performance is not good.
There's improvements I need to revise in the "processChunk" function, but watching the resource usage it seems the workers can't read in parallel.
I know that at the OS level, each thread locks the file while reading, but it seems the lock remains all the way while the stream is not at the final position.
36 replies
Is there a way to read big files using something like .seek but with ending position as well?
The concepts of streaming content from files or http connections I gasped well enough... I think... but Deno has a way of doing things that is different from Node, I'm not versed enough on Deno to give opinions yet, this challenge seemed like a good opportunity to test and learn
36 replies
Is there a way to read big files using something like .seek but with ending position as well?
So...
1 - Find the offsets I want to process
2 - Using those offsets calculate the segments of the file for each worker thread to process
3 - Openfile and use the ByteSliceStream updating the slice and parsing it in a loop until the sliceEnd >= workerData.end
36 replies
Is there a way to read big files using something like .seek but with ending position as well?
It seems I need to but the call for the ByteSliceStream inside a loop, so If there is a range of bytes I want to read, I calculate start and end for each iteration moving start and end along with the buffer size
36 replies
Is there a way to read big files using something like .seek but with ending position as well?
Ok, I'm reading this: https://medium.com/deno-the-complete-reference/read-last-n-bytes-from-a-file-in-deno-6a956ee6691e
36 replies
Is there a way to read big files using something like .seek but with ending position as well?
I'm asking because the challenge in question has a file with 1 billion lines, each line can have max 105 bytes... we are talking something around 13GB of data
36 replies
Is there a way to read big files using something like .seek but with ending position as well?
Hi @raunioroo , thanks for the tip with the ByteSliceStream. Is the "slice" a stream that can be read into a buffer? In the sense that as parts of the file are read up to a buffer size I can parse that buffer, empty it then a new stream is read into the buffer and so on...
36 replies