发布比调试慢...发生了什么? [英] Release is slower than debug... What's happening?

查看:76
本文介绍了发布比调试慢...发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个Windows服务只加载一个CSV文件并使用SqlBulkCopy在新创建的Sql Server 2005表中导入它的数据

25000行

批次。


如果我在调试模式下构建服务并运行它,我就会获得下降性能。

如果我在发布模式下构建它,我希望它至少能保持这么快并且可能更快,但实际上我失去了性能。我失去了大约10%

的表现。


这怎么可能发生?


这里有什么可以参与:

- SqlBulkCopy将一个IDataReader实现作为一个源来验证

的性能。

- < SqlDbTypes> .Parse( ...)

- 数组索引

- 对象的装箱和拆箱

- 按键搜索通用类(List,Dictionary,Hashtable)


谢谢


ThunderMusic

Hi,
I have a windows service that only loads a CSV file and import it''s data
using SqlBulkCopy in a newly created Sql Server 2005 table using 25000 rows
batches.

If I build the service in debug mode and run it, I get descent performances.
If I build it in release mode, I would expect it to at least stay as fast
and maybe be faster, but I actually lose performance. I lose about 10%
performance.

How can this happen?

Here''s what could be involved :
- SqlBulkCopy Class a IDataReader implementation as a source which
performance has been verified.
- <SqlDbTypes>.Parse(...)
- Array indexing
- Boxing and Unboxing of objects
- Generic classes (List, Dictionary, Hashtable) search by key

Thanks

ThunderMusic

推荐答案

oups

- SqlBulkCopy将一个IDataReader实现作为一个源来验证

的性能。


应该读取

- SqlBulkCopy类使用IDataReader实现作为源已经验证了

的性能。

ThunderMusic < No ************************* @ NoSpAm.com写信息

新闻:或***** ********* @ TK2MSFTNGP05.phx.gbl ...
oups
- SqlBulkCopy Class a IDataReader implementation as a source which
performance has been verified.

should read

- SqlBulkCopy Class using a IDataReader implementation as a source which
performance has been verified.
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:OR**************@TK2MSFTNGP05.phx.gbl...



我有一个Windows服务,只使用25000

行批次在新创建的Sql Server 2005表中使用SqlBulkCopy加载CSV文件并导入其数据



如果我在调试模式下构建服务并运行它,我会下降

表演。如果我在发布模式下构建它,我会期望它至少可以保持快速并且可能更快,但实际上我失去了性能。我输了

大约10%的性能。


怎么会发生这种情况?


这里有什么可以参与:

- SqlBulkCopy将一个IDataReader实现作为一个源来验证

的性能。

- < SqlDbTypes> .Parse( ...)

- 数组索引

- 对象的装箱和拆箱

- 按键搜索通用类(List,Dictionary,Hashtable)


谢谢


ThunderMusic
Hi,
I have a windows service that only loads a CSV file and import it''s data
using SqlBulkCopy in a newly created Sql Server 2005 table using 25000
rows batches.

If I build the service in debug mode and run it, I get descent
performances. If I build it in release mode, I would expect it to at least
stay as fast and maybe be faster, but I actually lose performance. I lose
about 10% performance.

How can this happen?

Here''s what could be involved :
- SqlBulkCopy Class a IDataReader implementation as a source which
performance has been verified.
- <SqlDbTypes>.Parse(...)
- Array indexing
- Boxing and Unboxing of objects
- Generic classes (List, Dictionary, Hashtable) search by key

Thanks

ThunderMusic





" ThunderMusic" < No ************************* @ NoSpAm.com写信息

新闻:或***** ********* @ TK2MSFTNGP05.phx.gbl ...

"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:OR**************@TK2MSFTNGP05.phx.gbl...



我有一个Windows服务,只使用25000

行批次在新创建的Sql Server 2005表中使用SqlBulkCopy加载CSV文件并导入其数据



如果我在调试模式下构建服务并运行它,我会下降

表演。如果我在发布模式下构建它,我会期望它至少可以保持快速并且可能更快,但实际上我失去了性能。我失去了
大约10%的表现。


怎么会发生这种情况?
Hi,
I have a windows service that only loads a CSV file and import it''s data
using SqlBulkCopy in a newly created Sql Server 2005 table using 25000
rows batches.

If I build the service in debug mode and run it, I get descent
performances. If I build it in release mode, I would expect it to at least
stay as fast and maybe be faster, but I actually lose performance. I lose
about 10% performance.

How can this happen?



您是在测量首次运行性能还是稳定状态?


首次运行需要运行JIT编译器,在发布模式下,

JIT必须寻找优化,因此需要更长的时间。但是,在编译代码后,
编译后,重新运行它的增量成本通常会因优化而大大减少。

Are you measuring first run performance, or steady state?

The first run requires that the JIT compiler be run, and in release mode the
JIT has to look for optimizations, hence taking longer. After the code is
compiled, however, the incremental cost of rerunning it is usually greatly
reduced by the optimizations.


>

这里有可能涉及的内容:

- SqlBulkCopy将一个IDataReader实现类作为一个来源

性能已经过验证。

- < SqlDbTypes> .Parse(...)

- 数组索引

- 对象的装箱和拆箱

- 通用类(List,Dictionary,Hashtable)按键搜索


谢谢


ThunderMusic
>
Here''s what could be involved :
- SqlBulkCopy Class a IDataReader implementation as a source which
performance has been verified.
- <SqlDbTypes>.Parse(...)
- Array indexing
- Boxing and Unboxing of objects
- Generic classes (List, Dictionary, Hashtable) search by key

Thanks

ThunderMusic



即使经过多次运行,它仍然会变慢。


" Ben Voigt [C ++ MVP ]" < rb*@nospam.nospamwrote in message

news:u3 ************** @ TK2MSFTNGP06.phx.gbl ...
Even after many runs, it''s still slower.

"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:u3**************@TK2MSFTNGP06.phx.gbl...

>

" ThunderMusic" < No ************************* @ NoSpAm.com写信息

新闻:或***** ********* @ TK2MSFTNGP05.phx.gbl ...
>
"ThunderMusic" <No*************************@NoSpAm.comwrote in message
news:OR**************@TK2MSFTNGP05.phx.gbl...

>
我有一个只加载的Windows服务一个CSV文件并使用SqlBulkCopy在新创建的Sql Server 2005表中使用25000行批量导入它的数据

如果我在调试模式下构建服务并且跑吧,我得到血统的表演。如果我在发布模式下构建它,我希望它能够保持最快速度并且可能更快,但实际上我会失去性能。
我失去了大约10%的性能。
>Hi,
I have a windows service that only loads a CSV file and import it''s data
using SqlBulkCopy in a newly created Sql Server 2005 table using 25000
rows batches.

If I build the service in debug mode and run it, I get descent
performances. If I build it in release mode, I would expect it to at
least stay as fast and maybe be faster, but I actually lose performance.
I lose about 10% performance.

How can this happen?



您是在测量首次运行性能还是稳定状态?


首次运行需要运行JIT编译器,在发布模式中,JIT必须寻找优化,因此需要更长的时间。然而,在编译了

代码之后,重新运行代码的增量成本通常会因优化而大大降低。


Are you measuring first run performance, or steady state?

The first run requires that the JIT compiler be run, and in release mode
the JIT has to look for optimizations, hence taking longer. After the
code is compiled, however, the incremental cost of rerunning it is usually
greatly reduced by the optimizations.


>>
以下是可能涉及的内容:
- SqlBulkCopy将IDataReader实现类作为已经验证了性能的源。
- < ; SqlDbTypes> .Parse(...)
- 数组索引
- 对象的装箱和拆箱
- 通用类(List,Dictionary,Hashtable)按键搜索

谢谢

ThunderMusic
>>
Here''s what could be involved :
- SqlBulkCopy Class a IDataReader implementation as a source which
performance has been verified.
- <SqlDbTypes>.Parse(...)
- Array indexing
- Boxing and Unboxing of objects
- Generic classes (List, Dictionary, Hashtable) search by key

Thanks

ThunderMusic




这篇关于发布比调试慢...发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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