buffering

Speed up reading in a compressed bz2 file ('rb' mode)

若如初见. 提交于 2021-02-11 14:21:37
问题 I have a BZ2 file of more than 10GB. I'd like to read it without decompressing it into a temporary file (it would be more than 50GB). With this method: import bz2, time t0 = time.time() time.sleep(0.001) # to avoid / by 0 with bz2.open("F:\test.bz2", 'rb') as f: for i, l in enumerate(f): if i % 100000 == 0: print('%i lines/sec' % (i/(time.time() - t0))) I can only read ~ 250k lines per second. On a similar file, first decompressed , I get ~ 3M lines per second, i.e. a x10 factor: with open("F

StreamReader and buffer in C#

Deadly 提交于 2021-02-07 12:38:34
问题 I've a question about buffer usage with StreamReader. Here: http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx you can see: "When reading from a Stream, it is more efficient to use a buffer that is the same size as the internal buffer of the stream.". According to this weblog , the internal buffer size of a StreamReader is 2k, so I can efficiently read a file of some kbs using the Read() avoiding the Read(Char[], Int32, Int32) . Moreover, even if a file is big I can construct

StreamReader and buffer in C#

社会主义新天地 提交于 2021-02-07 12:38:30
问题 I've a question about buffer usage with StreamReader. Here: http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx you can see: "When reading from a Stream, it is more efficient to use a buffer that is the same size as the internal buffer of the stream.". According to this weblog , the internal buffer size of a StreamReader is 2k, so I can efficiently read a file of some kbs using the Read() avoiding the Read(Char[], Int32, Int32) . Moreover, even if a file is big I can construct

Stop audio buffering in the <audio> tag

谁说胖子不能爱 提交于 2021-01-21 06:29:19
问题 I am currently working in using the HTML5 audio player to provide a audio stream (24/7 radio stream) via the (mobile) browser. Loading in the stream and playing it works fine. The major problem is that the HTML5 <audio> tag will keep downloading (buffering) content even when its not active. This could be a major issue for mobile users since most of them pay for data use. So far I have not been able to find a decent solutions that works cross browser to prevent this. I tried so far: Unload the

Stop audio buffering in the <audio> tag

痞子三分冷 提交于 2021-01-21 06:27:22
问题 I am currently working in using the HTML5 audio player to provide a audio stream (24/7 radio stream) via the (mobile) browser. Loading in the stream and playing it works fine. The major problem is that the HTML5 <audio> tag will keep downloading (buffering) content even when its not active. This could be a major issue for mobile users since most of them pay for data use. So far I have not been able to find a decent solutions that works cross browser to prevent this. I tried so far: Unload the

What is the alternate of HttpRequest.EnableRewind() in ASP.NET Core 3.0?

岁酱吖の 提交于 2020-01-14 07:06:08
问题 BufferingHelper.EnableRewind(); Above is an extension method for HttpRequest object in ASP.NET Core 2.2. It is no more there in ASP.NET Core 3.0 (atleast with this name). I want to know it's alternate in ASP.NET Core 3.0. I am not sure if HttpRequestRewindExtensions.EnableBuffering(); is the alternate. 回答1: The alternate is HttpRequestRewindExtensions.EnableBuffering() , indeed. You can see here that internally it just calls EnableRewind() . 来源: https://stackoverflow.com/questions/57407472

Which JDBC drivers support scroll sensitive/insensitive properly?

我的未来我决定 提交于 2020-01-06 16:00:13
问题 I just found out that the Postgres Java JDBC driver does not really support the SCROLL_SENSITIVE / SCROLL_INSENSITIVE modes using streaming, but instead simulates those modes by loading the full result set into client memory all at once. For queries with a big result set, that can lead to an unexpectedly huge memory usage, especially in a language like Java with little support for unboxed values. When using FORWARD_ONLY mode, the driver streams the results as expected. (details; From my