2 Replies - 1131 Views - Last Post: 04 March 2009 - 01:25 PM Rate Topic: -----

#1 laddikey   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 17-February 09

Design help with math functions inside string repeated being executed

Posted 04 March 2009 - 06:56 AM

I am building an application which will will making hundreds of thousands (perhaps into the millions) of computations. Speed is critical due to the number of calculations. Functions are stored various XML files. These functions contain both actual numbers as well as "placeholders" which are populated from various objects at the point of execution. The functions are stable (ie. do not change) once read in however they are repeatedly executed inside of nested loops with the placeholders being repopulated.

In my initial project I have the function strings being parsed each iteration however this is prohibitively slow. Please note that this is currently functional. I am reading in the string from XML, parsing it properly, replacing the placeholders with the correct data, and then refining and executing the function correctly. It is simply not efficient the way that I am doing it.

What I need to do (I believe) is:
1. parse the string,
2. locate and identify my placeholders,
3. enter my looping structures to execute the functions repeated using the new values for each iteration.

Can I get some input on how to design & code this up please? What I have in mind is that I need to convert the string into a usable function that is then repeated called with the variables being updated but I can't get my mind around how to make this happen.

I have tried to give all of the relevant details here however feel free to quiz me on anything that you need to know in order to help me evaluate and improve what I am doing.

Thanks,
michael

Is This A Good Question/Topic? 0
  • +

Replies To: Design help with math functions inside string repeated being executed

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Design help with math functions inside string repeated being executed

Posted 04 March 2009 - 08:25 AM

Have you profiled your code to find the bottleneck? That's where I'd start.
Was This Post Helpful? 0
  • +
  • -

#3 laddikey   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 17-February 09

Re: Design help with math functions inside string repeated being executed

Posted 04 March 2009 - 01:25 PM

Ok, I have installed DevPartner and will run a full profile over the course of the night (any suggestions on other profilers that might be better? I am not interested in paying lots of money for this at the moment when there are a couple of other software packages to be purchased). I still feel though that there has to be a better approach to my application rather than parsing a string hundreds/thousands/multiple thousands of times.

Any thoughts or ideas?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1