我真的必须使用阵列吗? [英] Do I really have to use an array?

查看:84
本文介绍了我真的必须使用阵列吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。


我不能相信我可能不得不在这里使用阵列。


我有这个bignum包我是用C ++制作的分形

生成器,并尝试了一种方法,在这里建议我一段时间

回来,关于使用堆栈向量 ;而不是一个静态数组。


无论如何,我把这个建议付诸实施,似乎是例程

使用了一堆向量(一个in-地方乘法程序)

真的很慢 - 对我来说太慢了。不合时宜的乘法

就像两倍快。是什么赋予了?我是否真的必须在堆栈上使用邪恶的

数组? (在我的代码中,它将类似于Digit

tmpBuf [2 * MAX_PRECISION]。)我不这么认为,因为它被称为

堆栈向量方法至少与数组一样快。


如果需要,可以在此处获取相关的代码片段:
http://www.mediafire.com/?51qszh1cv2j

推荐答案

mike3< mi ****** @ yahoo.comwrote:
mike3 <mi******@yahoo.comwrote:

我不敢相信我可能不得不在这里使用一个数组。


我已经用C ++制作了这个bignum包,用于分形

生成器,并尝试了我在这里建议的方法有一段时间

回来,关于使用堆叠的向量而不是一个静态数组。


无论如何,我把这个建议付诸实施,似乎是例程

使用了一堆向量(一个in-地方乘法程序)

真的很慢 - 对我来说太慢了。不合时宜的乘法

就像两倍快。是什么赋予了?我是否真的必须在堆栈上使用邪恶的

数组? (在我的代码中,它将类似于Digit

tmpBuf [2 * MAX_PRECISION]。)我不这么认为,因为它被称为

堆栈向量方法至少与数组一样快。


如果需要,可以在此处获取相关的代码片段:
http://www.mediafire.com/?51qszh1cv2j



你开启了优化吗?在某些系统中,除非已启用完全优化,否则向量会执行一大堆错误检查。

Did you turn on optimization? In some systems vector does a whole bunch
of error checking unless full optimizations have been turned on.


1月24日上午5:41 ,Daniel T. < danie ... @ earthlink.netwrote:
On Jan 24, 5:41 am, "Daniel T." <danie...@earthlink.netwrote:

mike3< mike4 ... @ yahoo.comwrote:
mike3 <mike4...@yahoo.comwrote:

我不能相信我可能不得不在这里使用数组。
I can''t believe I may have to use an array here.


我已经用C ++制作了这个bignum包,用于分形

生成器,并尝试了一种方法在这里向我建议了一段时间

回来,关于使用堆栈向量而不是静态数组。
I''ve got this bignum package I was making in C++ for a fractal
generator, and tried an approach that was suggested to me here a while
back, about using a "stack of vectors" instead of a static array.


无论如何,我把这个建议付诸实施,似乎是使用堆栈向量的常规

(就地增殖例程)实际上很慢 - 对我来说太慢了。不合时宜的乘法

就像两倍快。是什么赋予了?我是否真的必须在堆栈上使用邪恶的

数组? (在我的代码中,它将类似于Digit

tmpBuf [2 * MAX_PRECISION]。)我不这么认为,因为它被称为

堆栈向量方法至少与数组一样快。
Anyway, I put the suggestion into effect, and it seems the routine
that uses the stack of vectors (an in-place multiplication routine) is
real slow -- too slow for my liking. The out-of-place multiplication
is like twice as fast. What gives? Do I really have to use an evil
array on the stack? (in my code it would be something like "Digit
tmpBuf[2*MAX_PRECISION]".) I don''t think so since it was said the
stack-of-vectors approach can be at least as fast as the array.


如果需要,可以在此处获取相关的代码片段:
http://www.mediafire.com/?51qszh1cv2j



你打开了吗?优化?在某些系统中,除非已启用完全优化,否则向量会执行大量错误检查


Did you turn on optimization? In some systems vector does a whole bunch
of error checking unless full optimizations have been turned on.



是的,我做到了。它似乎不是矢量 - 不合适的

例程

也使用矢量,它的执行速度是in-的两倍地方

一,

至少在我的机器上。它似乎与该堆栈有关

thingy。

Yes, I did. It doesn''t seem to be the vector -- the out-of-place
routine
uses vectors as well, and it performs twice as fast as the in-place
one,
at least on my machine. It seems to have to do with that stack
thingy.


在文章< 1d5185f0-b105-4201-9c52-
b2**********@v46g2000hsv.googlegroups.com >, mi******@yahoo.com 说...


[...]
In article <1d5185f0-b105-4201-9c52-
b2**********@v46g2000hsv.googlegroups.com>, mi******@yahoo.com says...

[ ... ]

是的,我做到了。它似乎不是矢量 - 不合适的

例程也使用矢量,它的执行速度是

的两倍 - 放置一个,至少在我的机器上。这似乎与

有关。
Yes, I did. It doesn''t seem to be the vector -- the out-of-place
routine uses vectors as well, and it performs twice as fast as the
in-place one, at least on my machine. It seems to have to do with
that stack thingy.



如果您发布(此处或网站)代码

可以编译和包含(至少)

你遇到问题的例程。


-

后来,

杰里。


宇宙是自己想象的虚构。

It would help tremendously if you posted (here or to the web site) code
that could be compiled and included (at least) the routine with which
you''re having a problem.

--
Later,
Jerry.

The universe is a figment of its own imagination.


这篇关于我真的必须使用阵列吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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