473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

array operators

PJ6
I'm looking for a way to increase performance on a few rather simple integer
array operations, such as adding the values of one to another. I know I can
do this procedurally, but was wondering if there wasn't some sort of "mass"
operation that would be faster, and can be done in one command. Is there?

Paul

May 7 '06 #1
3 1204
PJ6,

Be aware that the 8086 processor familly and descents have a small set of
instructions, this means that your mass operation will still be a lot of
processing. Therefore look how values are stored and you are halfway your
question. Avoid boxing, avoid fixed arrays.

By instance this seems a clever instruction using late binding
dim c as integer = 10
dim d as decimal = 10
dim c as double = myadder(b, c)
c = myadder(c, a)

public function myadder(byval b as object, c as object) as object
return b + c
end sub

However it is not, it cost very much processor cycles

Cor

"PJ6" <no***@nowhere.net> schreef in bericht
news:uj**************@TK2MSFTNGP03.phx.gbl...
I'm looking for a way to increase performance on a few rather simple
integer
array operations, such as adding the values of one to another. I know I
can
do this procedurally, but was wondering if there wasn't some sort of
"mass"
operation that would be faster, and can be done in one command. Is there?

Paul

May 8 '06 #2
PJ6
Very well, but I also know that there are "bitblt" operations that are
(supposedly) insanely fast with large amounts of data, this is what I was
after.

Some of what I'm doing can be performed with Matrix operations, but I don't
really know if that is any faster than a vanilla interative procedure,
either.

Paul

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uX**************@TK2MSFTNGP04.phx.gbl...
PJ6,

Be aware that the 8086 processor familly and descents have a small set of
instructions, this means that your mass operation will still be a lot of
processing. Therefore look how values are stored and you are halfway your
question. Avoid boxing, avoid fixed arrays.

By instance this seems a clever instruction using late binding
dim c as integer = 10
dim d as decimal = 10
dim c as double = myadder(b, c)
c = myadder(c, a)

public function myadder(byval b as object, c as object) as object
return b + c
end sub

However it is not, it cost very much processor cycles

Cor

"PJ6" <no***@nowhere.net> schreef in bericht
news:uj**************@TK2MSFTNGP03.phx.gbl...
I'm looking for a way to increase performance on a few rather simple
integer
array operations, such as adding the values of one to another. I know I
can
do this procedurally, but was wondering if there wasn't some sort of
"mass"
operation that would be faster, and can be done in one command. Is there?

Paul


May 8 '06 #3
PJ6
OK I found a better approach...

Storing and operating on partial derivatives (along the y-axis) of the data
reduced the number of required calculations by 1-2 orders of magnitude.

I'm sure if I had been a computer science major this would have been the
first thing to occur to me... but I guess I'm just glad it came to me at
all.

Paul

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:uX**************@TK2MSFTNGP04.phx.gbl...
PJ6,

Be aware that the 8086 processor familly and descents have a small set of
instructions, this means that your mass operation will still be a lot of
processing. Therefore look how values are stored and you are halfway your
question. Avoid boxing, avoid fixed arrays.

By instance this seems a clever instruction using late binding
dim c as integer = 10
dim d as decimal = 10
dim c as double = myadder(b, c)
c = myadder(c, a)

public function myadder(byval b as object, c as object) as object
return b + c
end sub

However it is not, it cost very much processor cycles

Cor

"PJ6" <no***@nowhere.net> schreef in bericht
news:uj**************@TK2MSFTNGP03.phx.gbl...
I'm looking for a way to increase performance on a few rather simple
integer
array operations, such as adding the values of one to another. I know I
can
do this procedurally, but was wondering if there wasn't some sort of
"mass"
operation that would be faster, and can be done in one command. Is there?

Paul


May 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan | last post by:
I wonder if anyone has suggestions for reducing the amount of time it would take to search my array using the function that I have written. I want to find a position in the array of an item that...
17
by: yinglcs | last post by:
Hi, In STL, can I create a variable size but non-growable array? In Java, I can do this: int void f (int size) { int array = new int; // do something with array return array;
11
by: Leszek | last post by:
Hi I' m trying convert a php array to a javascript array like this: var danevar1 = "<? print $dane1; ?>"; var danearray1= new Array(); danearray1 = danevar1.split(","); var suma1=0; for(var...
51
by: Pedro Graca | last post by:
I run into a strange warning (for me) today (I was trying to improve the score of the UVA #10018 Programming Challenge). $ gcc -W -Wall -std=c89 -pedantic -O2 10018-clc.c -o 10018-clc...
24
by: Kavya | last post by:
int main (){ int a={{1,2,3},{4,5,6}}; int (*ptr)=a; /* This should be fine and give 3 as output*/ printf("%d\n",(*ptr)); ++ptr;
20
by: subramanian | last post by:
Hello I have a doubt in the following piece of code: int a; printf("a=%p\n", a); printf("&a=%p\n", &a); these printf statements print the same value for both 'a' and '&a". I tried in...
18
by: mdh | last post by:
>From p112 ( K&R). Given an array declared as static char arr= { { 0,1,........},{0,1,.....}}; let arr be passed as an argument to f. f( int (*arr) ) {....} It is noted that the...
9
by: Srinu | last post by:
Hi All, We know the following facts, 1. A two dimentional arrays in C is stored similar to a single dimentional array. 2. * is the dereference operator that gives value at address denoted by...
26
by: aruna.mysore | last post by:
Hi all, I have a specific problem passing a function pointer array as a parameter to a function. I am trying to use a function which takes a function pointer array as an argument. I am too sure...
7
by: John Koleszar | last post by:
Hi all, I'm porting some code that provides compile-time assertions from one compiler to another and ran across what I believe to be compliant code that won't compile using the new compiler. Not...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.