473,395 Members | 2,006 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,395 software developers and data experts.

Variable execution speed

I have an application that consists of a managed C++ wrapper around an
unmanaged C++ "engine" that performs a very processor intensive task. In
the application I create two instances of the managed wrapper (and therefore
of the unmanaged engine) on separate threads so that it can be working on two
scenarios at the same time. The engine keeps track of certain counters so
that I can monitor it's progress.

However, I'm finding that the engine executes at different speeds on
different occasions when I run the application with exactly the same
scenarios. In fact, sometimes one instance of the engine runs at the speed
I'm expecting and the other runs at about one tenth of the normal speed, even
though they are instances of exactly the same code, running on a dual core
processor with nothing else running at the same time.

I find myself running the application, checking the speed, and, if it's not
running at the normal speed I shut it down, start it again, check the speed,
etc, until, for no apparent reason, it starts up running at full speed. It's
the only way I can find to get the application working at full potential on
both threads and it's very annoying!

Does anyone have any idea what might be causing this? I'm still a C++
beginner so I'm hoping this can be fixed with a compiler option or two.

I'm using VC++ 2005 on a Pentium D and Win2K.

Thanks in advance.
Oct 3 '07 #1
1 1348
However, I'm finding that the engine executes at different speeds on
different occasions when I run the application with exactly the same
scenarios. In fact, sometimes one instance of the engine runs at the
speed
I'm expecting and the other runs at about one tenth of the normal speed,
even
though they are instances of exactly the same code, running on a dual core
processor with nothing else running at the same time.

Does anyone have any idea what might be causing this? I'm still a C++
beginner so I'm hoping this can be fixed with a compiler option or two.

I'm using VC++ 2005 on a Pentium D and Win2K.
What are your threads doing? Are they working on the same data? Do they use
global data / file io/ synchronization mechanisms like mutexes, events or
critical sections?
There are a lot of things that influence the perfromance of parallel
programmed threads. We need some more info to help you.

--
Kind regards,
Bruno van Dooren MVP - VC++
http://msmvps.com/blogs/vanDooren
br**********************@hotmail.com
Oct 8 '07 #2

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

Similar topics

3
by: linvin333 | last post by:
Hi, Does function overloading affect the speed of execution of the program ? If so what is the reason ? How does it compare with a speed of a program using non-overloded functions ? Linny
1
by: gregbacchus | last post by:
Hi, Here's my problem: I want to write a stored procedure that returns all records from a table that have a certain column starting with given text. I however find that using LIKE and a variable...
7
by: Klaus Johannes Rusch | last post by:
Is the following code valid and supported by current implementations? function somename() { this.show = function () { document.write("somename called") } } var somename = new somename();...
3
by: Grant Wagner | last post by:
Given the following working code: function attributes() { var attr1 = arguments || '_'; var attr2 = arguments || '_'; return ( function (el1, el2) { var value1 = el1 + el1; var value2 = el2...
9
by: Peng Jian | last post by:
I have a function that is called very very often. Can I improve its efficiency by declaring its local variables to be static?
40
by: kavi | last post by:
Hello friends, Could any one tell the way of calculating the speed of c program execution?
2
by: William Ahern | last post by:
So, I recently learned that Solaris doesn't, or doesn't seem, to provide err.h. On some platforms err.h provides simple wrappers for error printing to stderr. One of which, err(), has this...
16
by: John | last post by:
Does the length of my C variable names have any affect, performance-wise, on my final executable program? I mean, once compiled, etc., is there any difference between these two: number = 3; n =...
25
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.