虚拟基础MI的高性能替代方案 [英] High performance alternative to MI of virtual bases

查看:58
本文介绍了虚拟基础MI的高性能替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于没有人回复我之前的帖子[带接口的C ++],我以为我会用b $ b来尝试解释我的做法有点不同。


当多次继承纯虚拟(抽象)基类时,一个类

显然会为每个需要的新vtable快速膨胀。执行速度也会大幅下降
。您可以通过使用接口来解决这个问题。

referemnces具有指向对象的指针和指向外部

函数查找表的指针。这种技术需要额外的输入,但产生了非常高效的代码。我已经为C ++写了一个语言扩展,

促进了这种技术,它可以在
http://www.heron-language.com/heronfront.html

我希望从小组中得到的是让人们分开我的例子,并且我使用的技术是b $ b。另一件事是找出谁对这项工作感兴趣

,以及网上其他地方是否有其他类似的工作。


谢谢!


-

Christopher Diggins - http ://www.cdiggins.com

苍鹭的设计师 - http://www.heron-language.com

Since nobody responded to my earlier post [C++ with interfaces], I thought I
would try to explain what I am doing a bit differently.

When multiply inheriting pure virtual (abstract) base classes, a class
obviously bloats quickly for each new vtable needed. Execution slows down
considerably as well. You can work around this by using interfaces
referemnces which have a pointer to the object and a pointer to an external
function lookup table. This technique requires extra typing but produces
very efficient code. I have written a language extension to C++ which
facilitates this technique and it is available at
http://www.heron-language.com/heronfront.html

What I am hoping from the group is for people to pick apart my examples, and
the techniques I am using. The other thing is to find out who is interested
in this work, and whether there is other similar work elsewhere on the net.

Thanks!

--
Christopher Diggins - http://www.cdiggins.com
designer of Heron - http://www.heron-language.com

推荐答案

christopher diggins写道:
christopher diggins wrote:
由于没有人回复我之前的帖子[带接口的C ++],我想我会尝试解释我的做法有点不同。

当多次继承纯虚拟时(抽象)基类,对于每个需要的新vtable,一个类显然会很快膨胀。执行速度也相当慢。您可以通过使用具有指向对象的指针的接口和指向
外部函数查找表的指针来解决此问题。这种技术需要额外的打字,但
会产生非常有效的代码。我已经为C ++写了一个语言扩展,这有助于这种技术,它可以在
http://www.heron-language.com/heronfront.html

我希望小组能够分享我的例子,
和我正在使用的技术。另一件事是找出谁对这项工作感兴趣,以及网上是否还有其他类似的工作。

谢谢!
Since nobody responded to my earlier post [C++ with interfaces], I thought
I would try to explain what I am doing a bit differently.

When multiply inheriting pure virtual (abstract) base classes, a class
obviously bloats quickly for each new vtable needed. Execution slows down
considerably as well. You can work around this by using interfaces
referemnces which have a pointer to the object and a pointer to an
external function lookup table. This technique requires extra typing but
produces very efficient code. I have written a language extension to C++
which facilitates this technique and it is available at
http://www.heron-language.com/heronfront.html

What I am hoping from the group is for people to pick apart my examples,
and the techniques I am using. The other thing is to find out who is
interested in this work, and whether there is other similar work elsewhere
on the net.

Thanks!



您是否考虑过将此发布到comp.std.c ++?

-

p-> m ==(* p).m = = p [0] .m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org


Have you considered posting this to comp.std.c++?
--
p->m == (*p).m == p[0].m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org


christopher diggins写道:
christopher diggins wrote:
由于没有人回复我之前的帖子[带接口的C ++],我想
我会尝试解释我的做法有点不同。<当继承纯虚拟(抽象)基类时,一个类显然会为每个新的vtable快速膨胀。执行速度也相当慢。您可以通过使用具有指向对象的指针的接口和指向
外部函数查找表的指针来解决此问题。这种技术需要额外的打字,但
会产生非常有效的代码。我已经为C ++写了一个语言扩展,这有助于这种技术,它可以在
http://www.heron-language.com/heronfront.html

我希望小组能够分享我的例子,
和我正在使用的技术。另一件事是找出谁对这项工作感兴趣,以及网上是否还有其他类似的工作。

谢谢!
Since nobody responded to my earlier post [C++ with interfaces], I thought
I would try to explain what I am doing a bit differently.

When multiply inheriting pure virtual (abstract) base classes, a class
obviously bloats quickly for each new vtable needed. Execution slows down
considerably as well. You can work around this by using interfaces
referemnces which have a pointer to the object and a pointer to an
external function lookup table. This technique requires extra typing but
produces very efficient code. I have written a language extension to C++
which facilitates this technique and it is available at
http://www.heron-language.com/heronfront.html

What I am hoping from the group is for people to pick apart my examples,
and the techniques I am using. The other thing is to find out who is
interested in this work, and whether there is other similar work elsewhere
on the net.

Thanks!



您是否考虑过将此发布到comp.std.c ++?

-

p-> m ==(* p).m = = p [0] .m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org


Have you considered posting this to comp.std.c++?
--
p->m == (*p).m == p[0].m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org


christopher diggins写道:
christopher diggins wrote:
由于没有人回复我之前的帖子[带接口的C ++],我想
我会尝试解释我的做法有点不同。<当继承纯虚拟(抽象)基类时,一个类显然会为每个新的vtable快速膨胀。执行速度也相当慢。您可以通过使用具有指向对象的指针的接口和指向
外部函数查找表的指针来解决此问题。这种技术需要额外的打字,但
会产生非常有效的代码。我已经为C ++写了一个语言扩展,这有助于这种技术,它可以在
http://www.heron-language.com/heronfront.html

我希望小组能够分享我的例子,
和我正在使用的技术。另一件事是找出谁对这项工作感兴趣,以及网上是否还有其他类似的工作。

谢谢!
Since nobody responded to my earlier post [C++ with interfaces], I thought
I would try to explain what I am doing a bit differently.

When multiply inheriting pure virtual (abstract) base classes, a class
obviously bloats quickly for each new vtable needed. Execution slows down
considerably as well. You can work around this by using interfaces
referemnces which have a pointer to the object and a pointer to an
external function lookup table. This technique requires extra typing but
produces very efficient code. I have written a language extension to C++
which facilitates this technique and it is available at
http://www.heron-language.com/heronfront.html

What I am hoping from the group is for people to pick apart my examples,
and the techniques I am using. The other thing is to find out who is
interested in this work, and whether there is other similar work elsewhere
on the net.

Thanks!




我刚刚看到Stroustrup的这些评论,并根据你的建议发现它们很有趣

。我承认没有完全跟随你所有的事情。

正在做。我现在根本没时间。我非常喜欢在语言中添加接口类型的想法。我的方法是

简单地将界面定义为ABC,如下所述。


我还没有看到你发布任何内容到comp.std .C ++。我不是想要b / b $ b劝阻你发布到c.l.c ++。有些人可能会发现你在讨论主题的问题。我倾向于认为它与C ++相关。

http://www.artima.com/intv/modern.html

" Bjarne Stroustrup:我有很多问题向人们解释并且

从来没有完全理解为什么它很难理解。从C ++的第一天开始,有数据类和没有数据的类。过去的重点

是从一个带有东西的根构建的,但是

总是抽象的基类。在八十年代中后期,它们通常被称为ABC(抽象基类):仅包含虚拟函数
的类。 1987年,我直接用C ++

支持纯接口,如果它有一个纯虚函数,那么这个类是抽象的,这是一个必须被覆盖的

函数。从那时起,我一直指出

,用C ++编写类的主要方法之一是没有任何

状态,也就是说,只是一个接口。


"从C ++视图中,抽象类和

接口之间没有区别。有时我们使用短语pure abstract class,意思是一个专门拥有纯虚函数(没有数据)的
类。这是最常见的抽象类。

。当我试图解释这一点时,我发现我无法有效地理解这个想法,直到我以纯虚函数的形式引入直接语言

支持。由于人们可以在基类中放入数据,因此他们觉得有必要这样做。人们构建了经典的脆弱基类,并获得了经典的脆弱基类

问题,我无法理解为什么人们会这样做。当我尝试使用C ++中直接支持的抽象基类来教授这个想法时,我获得了更多的运气,但很多人仍然没有得到它。我认为这对我来说是一个重大的教育失败。我没想到这个问题很好。

实际上与Simula社区的一些早期失败相匹配,以获得关键的新想法。一些新的想法难以理解,而且问题的部分原因是很多人不想学到一些新东西。他们认为他们知道答案。一旦我们认为我们知道答案,

就很难学到新东西。在
1991中的C ++编程语言第二版中描述了抽象类,其中包括几个例子,但不幸的是在整本书中没有系统地使用过。

-

p-> m ==(* p).m == p [0] .m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org



I just came across these comments by Stroustrup, and found them interesting
in light of your suggestions. I will admit to not fully following all you
are doing. I simply don''t have time right now. I do very much like the
idea of adding an interface type to the language. My approach would have
been to simply define an interface as an ABC as described below.

I haven''t seen you post anything to comp.std.c++. I wasn''t trying to
discourage you from posting to c.l.c++. Some people might find what you
are doing off topic. I tend to view it as relevant to C++.

http://www.artima.com/intv/modern.html
"Bjarne Stroustrup: I had a lot of problems explaining that to people and
never quite understood why it was hard to understand. From the first days
of C++, there were classes with data and classes without data. The emphasis
in the old days was building up from a root with stuff in it, but there
were always abstract base classes. In the mid to late eighties, they were
commonly called ABCs (Abstract Base Classes): classes that consisted only
of virtual functions. In 1987, I supported pure interfaces directly in C++
by saying a class is abstract if it has a pure virtual function, which is a
function that must be overridden. Since then I have consistently pointed
out that one of the major ways of writing classes in C++ is without any
state, that is, just an interface.

"From a C++ view there''s no difference between an abstract class and an
interface. Sometimes we use the phrase "pure abstract class," meaning a
class that exclusively has pure virtual functions (and no data). It is the
most common kind of abstract class. When I tried to explain this I found I
couldn''t effectively get the idea across until I introduced direct language
support in the form of pure virtual functions. Since people could put data
in the base classes, they sort of felt obliged to do so. People built the
classic brittle base classes and got the classic brittle base class
problems, and I couldn''t understand why people were doing it. When I tried
to teach the idea with abstract base classes directly supported in C++, I
had more luck, but many people still didn''t get it. I think it was a major
failure in education on my part. I didn''t imagine the problem well. That
actually matches some of the early failures of the Simula community to get
crucial new ideas across. Some new ideas are hard to get across, and part
of the problem is a lot of people don''t want to learn something genuinly
new. They think they know the answer. And once we think we know the answer,
it''s very hard to learn something new. Abstract classes were described,
with several examples, in The C++ Programming Language, Second Edition, in
1991, but unfortunately not used systematically throughout the book."
--
p->m == (*p).m == p[0].m
http://www.kdevelop.org
http://www.suse.com
http://www.mozilla.org


这篇关于虚拟基础MI的高性能替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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