472,784 Members | 1,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Fastest and optimise way to call a function

If a routine has to be called 10,000 times then what will be the fastest and the optimised way of calling this routine as per my knowledge "for loop" is one way....inline function won't solve the problem.....will preprocessor "#typedef" will be a benifit?
Jan 30 '08 #1
4 1580
weaknessforcats
9,208 Expert Mod 8TB
The fastest way is the inline function. There are no calls. No stack frames to allocate and deallocate.

10000 copies of the function along the thread of execution is the fastest way.

But there's bloat. Next best is an inline function inside a loop.

Next best is a function call inside a loop.
Jan 30 '08 #2
Inline function wont increase the size of the program...as every time a inline function is called the whole function is copied at the the time of the call of the function.

As requirement is though the fastest method but it should be an optimised one.

The fastest way is the inline function. There are no calls. No stack frames to allocate and deallocate.

10000 copies of the function along the thread of execution is the fastest way.

But there's bloat. Next best is an inline function inside a loop.

Next best is a function call inside a loop.
Jan 30 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
Inline function wont increase the size of the program...as every time a inline function is called the whole function is copied at the the time of the call of the function.
This is just not correct. Inline functions are copied inline by the compiler at compile time. That's why they are called in-line. At run time the bits are just executed. No calls.
Jan 31 '08 #4
Thank you very much for clearing the doubt:)
Jan 31 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: windandwaves | last post by:
Hi Gurus When I have a query in which I use a small function, e.g.: SELECT A03_FILES.ID, A03_FILES.D, hasvt() AS hsvVT FROM A03_FILES; where HasVT is defined below: --------------------
11
by: Ignacio X. Domínguez | last post by:
Hi. I'm developing a desktop application that needs to store some data in a local file. Let's say for example that I want to have an address book with names and phone numbers in a file. I would...
14
by: Mark Broadbent | last post by:
Does anybody know what is (factual please -not just guess) the quickest method to read data from a file? I am not interested in the format of the data (i.e. blocks, bytes, string etc) just that the...
44
by: Don Kim | last post by:
Ok, so I posted a rant earlier about the lack of marketing for C++/CLI, and it forked over into another rant about which was the faster compiler. Some said C# was just as fast as C++/CLI, whereas...
15
by: Buddy Home | last post by:
Hello, I'm trying to speed up a piece of code that is causing performance issues with our product. The problem is we are using serialization to convert the object to a string, this is costing us...
6
by: Klaas Vantournhout | last post by:
Hi, I have a question, which is just out of interest. What is the fastest way to do an odd/even check with c++ and if needed assembler. Assume n is an unsigned integer like type (unsigned...
5
by: jwgoerlich | last post by:
Hello group, What is the fastest way to remove line feeds from the end of a string? RegEx was too slow. I am using a for loop (code below), but that seems too cumbersome. Any suggestions...
12
by: Godzilla | last post by:
Hello, I'm trying to find a way to convert an integer (8-bits long for starters) and converting them to a list, e.g.: num = 255 numList = with the first element of the list being the...
10
by: BostonNole | last post by:
Using Visual Studio 2005, .NET 2.0 and VB.NET: I am looking for the fastest possible way to import a very large fixed width file (over 6 million records and over 1.2 GB file size) into a...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.