门数据库中的动态数组是否值得使用?

时间:2022-02-21 17:36:06

I am a new developer for a DOORS database and when writing scripts in dxl. If you know there are only 1 dimensional arrays in dxl. I wanted to use more than one dimension so I decided to use a dynamic array, but this slowed my script down a lot, and when we have around 14000 objects per module it would take a day or so for the script to run.

我是DOORS数据库的新开发人员,在用dxl编写脚本时也是如此。如果你知道dxl中只有一个一维数组。我想要使用不止一个维度,所以我决定使用一个动态数组,但这大大降低了我的脚本速度,当每个模块有大约14000个对象时,脚本运行大约需要一天的时间。

I was wondering if it is reasonable to use dynamic arrays in these scripts or if anyone has experience in dealing with dynamic arrays in databases?

我想知道在这些脚本中使用动态数组是否合理,或者是否有人有在数据库中处理动态数组的经验?

Just curious thanks!

只是好奇谢谢!

1 个解决方案

#1


9  

Dynamic arrays are considerably slower than C style arrays in DOORS, so you should avoid them if you know the size of the array beforehand.

动态数组比门中的C样式数组要慢得多,所以如果事先知道数组的大小,应该避免使用它们。

If you know the number of elements but need more dimensions you can do it like this:

如果你知道元素的数量但需要更多的维度,你可以这样做:

//Define an array of (for example) bool
int imax=5
int jmax=7
bool myarray[imax*jmax]

//Access for example element myarray[3][2]
int i=3
int j=2
bool mybool=myarray[i*jmax+j]

#1


9  

Dynamic arrays are considerably slower than C style arrays in DOORS, so you should avoid them if you know the size of the array beforehand.

动态数组比门中的C样式数组要慢得多,所以如果事先知道数组的大小,应该避免使用它们。

If you know the number of elements but need more dimensions you can do it like this:

如果你知道元素的数量但需要更多的维度,你可以这样做:

//Define an array of (for example) bool
int imax=5
int jmax=7
bool myarray[imax*jmax]

//Access for example element myarray[3][2]
int i=3
int j=2
bool mybool=myarray[i*jmax+j]