内联? [英] Inlining?

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

问题描述

据我所知,VB.NET不允许程序员明确地说明他们想要一个内联函数。现在,我是一个很大的粉丝

分解重复的代码,但我不想做太多的事情

在VB中如果有的话将成为一个明显的性能打击。那么:


1. VB编译器有时内联简单函数吗?

2.函数调用是否有很大的性能损失?


谢谢。

From what I can tell, VB.NET doesn''t allow programmers to say
explicitly that they want a function to be inlined. Now, I''m a big fan
of factoring out duplicate code, but I don''t want to do too much of it
in VB if there''s going to be a noticeable performance hit. So:

1. Does the VB compiler sometimes inline simple functions?
2. Is there much of a performance hit on a function call?

Thanks.

推荐答案

我使用的是VB5,所以这个答案可能有争议。这就是VB4 + 5 + 6的工作方式:
I use VB5, so this answer may be open to debate. This is how VB4+5+6 work:
1. VB编译器有时内联简单函数吗?
取决于项目属性中的编译选项。您可以将

更改为

快速代码

有很多内联,特别是较小的功能,这可能会导致

要生成的大型EXE文件。

小代码

这会影响函数,这与内联相反。它基本上是

找到类似的代码并将它们放入一个函数中尽可能保存

空间。

无优化

使程序完全如何。它没有内联,分解或

沿着这些线的其他操作。

2.函数调用是否有很多性能损失?
1. Does the VB compiler sometimes inline simple functions? Depends on the compilation options in the project properties. You can change
it to
Fast Code
Does a lot of inlining, especially smaller functions and this may cause a
large EXE file to be produced.
Small Code
This factors the functions, which is the opposite to inlining. It basically
finds similar code and puts them into a function wherever possible to save
space.
No Optimization
Leaves the program exactly how it is. It does no inlining, factorising, or
other manipulation along those lines.
2. Is there much of a performance hit on a function call?



取决于程序的处理能力和速度。在一个简短的
程序中,因子分解或内联对执行的速度无效。

在更大或重复的程序中,它可以改变速度。保理

(调用更多功能)花费更多时间推动和弹出堆栈和

调用其他功能。内联(插入符合

代码的函数)更快,但它确实创建了更多的文件大小。

这是程序员在创建时必须考虑的一个权衡健壮,

快速系统。我发现最好使用我自己的判断并使用No

优化,以便我可以设置多少因子/内联。


希望这有帮助。


-

QuickHare

(Qu ********** @ HEREHotmail.com)

直接删除NOT和HERE到电子邮件。

Enleve les NOT etHEREáE-Mail moi directement。


Depends on the processing power and speed of the program. In a short
program, factorising or inlining will do nothing to the speed of execution.
In a larger or repetitive program, it can change the speed. Factoring
(calling more functions) spends more time pushing and popping the stack and
calling other functions. Inlining (inserting functions in line with the
code) is faster, but it does create more file size.
This is one trade off programmers has to think about when creating a robust,
fast system. I find it better to use my own judgement and use No
Optimization so that I can set how much factoring/inlining occurs.

Hope this helps.

--
QuickHare
(Qu**********@HEREHotmail.com)
Remove the NOT and HERE to E-Mail direct.
Enleve les NOT et HERE á E-Mail moi directement.


这里几乎每个人都使用VB6或更低版本。虽然你可能会在这里得到VB.NET问题的答案,但你应该在新闻组中询问他们专门用于.NET编程的
。在他们的名字中查找单词dotnet

的新闻组。


对于news.devx.com新闻服务器,请尝试这些


vb.dotnet.discussion

vb.dotnet.technical


对于microsoft新闻服务器,请尝试这些新闻组...


microsoft.public.dotnet.general

microsoft.public.dotnet.languages.vb


有其他一些,但这些应该可以让你开始。


Rick - MVP


" Tony Vitonis" <无*** @ nowhere.com>在消息中写道

news:jx ******************** @ comcast.com ...
Almost everybody here is using VB6 or lower. While you may get a stray
answer to VB.NET questions here, you should ask them in newsgroups devoted
exclusively to .NET programming. Look for newsgroups with the word "dotnet"
in their name.

For the news.devx.com news server, try these

vb.dotnet.discussion
vb.dotnet.technical

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

There are some others, but these should get you started.

Rick - MVP


"Tony Vitonis" <no***@nowhere.com> wrote in message
news:jx********************@comcast.com...
来自我可以说,VB.NET不允许程序员明确地说明他们想要一个内联函数。现在,我是一个分解重复代码的忠实粉丝,但我不想在VB中做太多的事情,如果会有明显的性能影响。那么:

1. VB编译器有时会内联简单函数吗?
2.函数调用是否有很大的性能影响?

谢谢。
From what I can tell, VB.NET doesn''t allow programmers to say
explicitly that they want a function to be inlined. Now, I''m a big fan
of factoring out duplicate code, but I don''t want to do too much of it
in VB if there''s going to be a noticeable performance hit. So:

1. Does the VB compiler sometimes inline simple functions?
2. Is there much of a performance hit on a function call?

Thanks.



哇。只有三天时间监控新闻组,我已经发现

有人要放入我的杀戮文件。


祝你VB.NET好运警察努力,瑞克。我打算继续问这些问题,并继续回复他们

当其他人问他们时。再见了。 *点击*
Wow. Only three days monitoring the newsgroup, and I''ve already found
somebody to put in my kill file.

Best of luck in your VB.NET policing endeavor, Rick. I for one intend
to continue asking such questions, and to continue responding to them
when other people ask them. Bye now. *click*
ri ******** ****@NOSPAMcomcast.net 说...

这里几乎每个人都使用VB6或更低版本。虽然你可能会在这里得到一个对VB.NET问题的回答,但你应该在专门针对.NET编程的新闻组中询问它们。查找名称中带有dotnet
的新闻组。

对于news.devx.com新闻服务器,请尝试使用这些

vb.dotnet。讨论对于微软新闻服务器,试试这些新闻组......

microsoft.public.dotnet.general
microsoft .public.dotnet.languages.vb

还有其他一些,但这些应该可以让你开始。
ri************@NOSPAMcomcast.net says...

Almost everybody here is using VB6 or lower. While you may get a stray
answer to VB.NET questions here, you should ask them in newsgroups devoted
exclusively to .NET programming. Look for newsgroups with the word "dotnet"
in their name.

For the news.devx.com news server, try these

vb.dotnet.discussion
vb.dotnet.technical

For the microsoft news server, try these newsgroups...

microsoft.public.dotnet.general
microsoft.public.dotnet.languages.vb

There are some others, but these should get you started.
Tony Vitonis写道......

据我所知,VB.NET不允许程序员明确地说明他们想要一个内联函数。现在,我是分析重复代码的忠实粉丝,但我不想在VB中做太多的事情,如果有明显的性能那么击中。那么:

1. VB编译器有时会内联简单函数吗?
2.函数调用是否有很大的性能影响?

谢谢。
Tony Vitonis wrote...

From what I can tell, VB.NET doesn''t allow programmers to say
explicitly that they want a function to be inlined. Now, I''m a big
fan of factoring out duplicate code, but I don''t want to do too
much of it in VB if there''s going to be a noticeable performance
hit. So:

1. Does the VB compiler sometimes inline simple functions?
2. Is there much of a performance hit on a function call?

Thanks.



这篇关于内联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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