How have you pinpointed it down to a memory leak then? I mean, that would be a hard thing to figure out would it not? I don't do much with low level memory allocation.Matthew wrote:Not necessarily, it can simply be memory which is allocated too much.
In this case, that is what is happening. Something is being reallocated as it should be and is constantly growing when nothing needs to grow so much.

I used the MallocDebug performance tool with the OSX SDK.
Ah. I don't have any debugging tools but I do have techniques...like most programmers. But like I said, I don't really do much low level memory allocation work.Matthew wrote:I used the MallocDebug performance tool with the OSX SDK.

Have you used C++'s new and delete? That's an alternative way to perform memory allocation. C++ has nothing to replicate realloc() though. With malloc is simpler to view the memory block as completely un-assigned to any type so you have a little more control on how you use it. You could add several pieces of data in your own way using a void pointer I suppose. I've never done that.
I know of them and how to implement them, but have never used them on a real project.Matthew wrote:Have you used C++'s new and delete? That's an alternative way to perform memory allocation. C++ has nothing to replicate realloc() though. With malloc is simpler to view the memory block as completely un-assigned to any type so you have a little more control on how you use it. You could add several pieces of data in your own way using a void pointer I suppose. I've never done that.

Argh! Even after fixing memory leaks, CPython is faster.... Why? 

Matthew wrote:Argh! Even after fixing memory leaks, CPython is faster.... Why?
I think that sums up whyWikipedia wrote:CPython is the default, most-widely used implementation of the Python programming language. It is written in C. In addition to CPython, there are two other production-quality Python implementations: Jython, written in Java, and IronPython, which is written for the Common Language Runtime, as well as several experimental implementations.[1]
CPython is a bytecode interpreter. It has a foreign function interface with several languages including C, in which one must explicitly write bindings in a language other than Python.


CPython is an interpreter. That should automatically make it slower.
I've made my program 3 times faster. I'm going to continue adding features and I'll do further optimisation later.
I've made my program 3 times faster. I'm going to continue adding features and I'll do further optimisation later.
Ya, but it's still a high level language, making it almost automatically slow.Matthew wrote:CPython is an interpreter. That should automatically make it slower.
I've made my program 3 times faster. I'm going to continue adding features and I'll do further optimisation later.
Oh, and how do you get program speeds?
EDIT:
So, how do you wrap a language? I know what this means just not how to implement (I think I know what it means).But CGI has been obsoleted by today Web standards so I would think having a Web-enabled language (PHP, Perl, Python etc) to wrap your C++ program would be a better choice.

I was using a timer performance tool. It will slow it down a tiny bit. I'll use time.h for final tests or maybe a POSIX.
Wrap a programming language? I suppose what you wanted to do depends on the languages being used. If you wanted to run a C++ program on a webserver I think you could use the exec PHP command is it?
Wrap a programming language? I suppose what you wanted to do depends on the languages being used. If you wanted to run a C++ program on a webserver I think you could use the exec PHP command is it?
I will look for some.Matthew wrote:I was using a timer performance tool. It will slow it down a tiny bit. I'll use time.h for final tests or maybe a POSIX.
"time.h" is a **** to use. It's not really complex, just the functions/classes/ect are so anti-elegant that it's a real eye sore to work with.
The quote I previously displayed was from a C++ forum. I didn't even know you could get C++ code on a webserver but I figured you might know (instead of starting a new thread over there). I don't even know if it's really worth it, just wondered if it was possible.Matthew wrote:Wrap a programming language? I suppose what you wanted to do depends on the languages being used. If you wanted to run a C++ program on a webserver I think you could use the exec PHP command is it?
EDIT: Are there any other coding tools you use outside your IDE? I have never used any before but I assume there are some that would be a benefit to me.

I use just the xcode tools for OSX and iphone development. I've used Editra for web-scripting.
I think getting C++ code on a server depends on the server and host.
I think getting C++ code on a server depends on the server and host.
I haven't really checked out the tools available with my IDE...I should probably check that out. I use Code::Blocks with MinGW as the compiler.Matthew wrote:I use just the xcode tools for OSX and iphone development. I've used Editra for web-scripting.
I think getting C++ code on a server depends on the server and host.

XCode has something called instruments which has many debug and performance tools.
Would you recommend using the sort method? Or making your own? I can make an sorting algorithm but man is it difficult...
