随机访问文件 - 慢 [英] Random Access files - slow

查看:59
本文介绍了随机访问文件 - 慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将VB6应用程序转换为VB.NET。它的功能是从随机访问文件生成

报告,但与VB6版本相比,.NET版本可怜的b $ b慢。


我想我需要让FileStream类使用随机访问

文件,但它要求数据结构在一个字节数组中。我怎么转换它们?


S.

I have converted a VB6 app to VB.NET. It''s function is to generate
reports from a Random Access file but the .NET version is pathetically
slow compared to the VB6 version.

I think I need to to get the FileStream class to work with Random Access
Files, but it requires the data Structures to be in a byte array. How
do I convert them?

S.

推荐答案

你好Stuart,


你有没有Option Strict On在你的程序之上,也许它很慢

因为后期绑定。


我会尝试设置它,如果它不是..


Cor
Hi Stuart,

Do you have Option Strict On in top of your program, maybe it is slow
because of the late binding.

I would try to set that if it is not..

Cor
我已经将VB6应用程序转换为VB.NET。它的功能是从随机访问文件生成报告,但与VB6版本相比,.NET版本的速度慢得多。

我想我需要获取FileStream类以使用随机访问文件,但它要求数据结构位于字节数组中。我如何转换它们?
I have converted a VB6 app to VB.NET. It''s function is to generate
reports from a Random Access file but the .NET version is pathetically
slow compared to the VB6 version.

I think I need to to get the FileStream class to work with Random Access
Files, but it requires the data Structures to be in a byte array. How
do I convert them?



Cor写道:
Cor wrote:
嗨Stuart,
你的程序顶部是否有Option Strict On,可能因为后期绑定而很慢

如果不是,我会尝试设置。 。

Cor
Hi Stuart,

Do you have Option Strict On in top of your program, maybe it is slow
because of the late binding.

I would try to set that if it is not..

Cor




选项严格关闭。


我读过你不应该'不要使用VB'的FileOpen访问

文件的方法,并使用System.IO.Stream ....类,因为它的速度要快得多。我已经使用了FileStream,但由于字节数组的要求,我无法获得随机

访问文件以使用它。


我在我的vb6应用程序中运行的报告需要11秒。在.Net,它正在谈论51

秒!


S.



Option Strict is off.

I have read that you shouldn''t use VB''s "FileOpen" method to access
files, and use the System.IO.Stream.... class instead, as it''s much
faster. I have used FileStream where I can, but I can''t get Random
Access files to work with it, due to the Byte Array requirement.

A report I run in my vb6 app takes 11 seconds. In .Net it''s talking 51
seconds!

S.


Hi Stuart ,


为什么不设置选项Strict并查看你必须添加的铸件。


可能你会得到更高的性能。 />

Cor
Hi Stuart,

Why not set option Strict on and look what castings you have to add.

Probably you get a much higher performance.

Cor


这篇关于随机访问文件 - 慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆