QCustomPlot Discussion and Comments

QCustomPlot memory usedReturn to overview

Hello,I just found that the QCustomPlot easy to use.I just run the "Quadratic Demo" demo,and I changed the x,y vector size to 10,000,000,and I run the program,it plots very fast,but the memmory used is more than 800,000,000 Bytes.This is not we want.Will QCustomPlot change this ??

Thanks.

Yes, memory usage of QCP for very high data count is not as good as I'd like, due to some inherited data structures from old versions. This will definitely improve in the next major release, QCP 2.0.0.

A temporary fix for you might be to get rid of the error variables in the QCPData structure, and maybe even setting the data type to float instead of double. That should give you approximately a 80% reduction in the memory footprint, and it'll be done like this or very similar in QCP2.

Hi Emmanuel,

I have a similar concerns regarding memory usage (32bit application, lots of plots, lots of points)
I have two follow up questions :

- Do you plan to change the QCPGraph to remove the error handling or are you going to make another plottable ? Maybe make the QCPGraph with error handling derive from QCPGraph without ?

- Is there a timeline for QCP 2.0 release ? Can I help on this particular dev ? (I ask this because I see that there are no other authors of QCustomPlot in git history : do you accept pull request ?)

I am going to subclass QAbstractPlottable to make a simpler version of QCPGraph without error variables and 32bits datatypes anyway, this is exactly what I need. I was mostly going to copy the code from QCPGraph.
But this leads to code duplication, plus it will be a hassle to maintain when I want to merge with newer release.
If we can avoid duplicating the efforts here.

Hi Félix,

- The QCPData structure and thus QCPGraph will lose its error bar capability. In this way its memory footprint will be strongly reduced for most use cases (most people don't use error bars). The error bars will be promoted to be an own new plottable, which can then be attached to more than just a QCPGraph. You could think of attaching error bars to the QCPBars plottable for example. So this is a win-win, it reduces the default QCPGraph footprint and at the same time improves error bar flexibility.

- There is no fixed schedule for QCP2.0 and I'm somewhat reluctant to announce a date officially. It puts unnecessary pressure on the development and I think that's what's wrong with many software projects. With QCP development I'd rather take longer, think harder, and then eventually make better decisions. What I can say is that there is at least another minor release 1.4 in the pipeline. If I find features that are currently planned for 2.0 and I notice during development that they could in principle work without breaking backward compatibility, another minor release 1.5 will be put together. So the 2.0 is still some time out, let's say 12 Months roughly (This is not an official announcement ;).

I believe you'll be fine if you modify QCPGraph (or a copy of it) with the changes you describe. Once QCP2.0 is out, you basically have two choices: stick with your QCP 1.x version and keep your slim QCPGraph-derivative, or switch to QCP2 and use the slim QCPGraph that will be shipped with it. And both choices will allow you to retain the low memory footprint.

Regarding non-trivial contributions it's a bit difficult. Since I use dual-licensing and reserve the right to provide other licenses, I am obligated to have the copyright on the source code. This means contributors need to agree to a so-called CLA, Contributor License Agreement, as many free software projects use. That makes sure the copyright on the contribution is transferred. Of course, non-trivial contribtors will be mentioned on the website if they like, but I can't have the copyright be spread out among multiple people. This is an unfortunate situation shared by many other free software projects. I don't like the concept of copyright transferral myself, and I wish there was a simpler solution.

Ok thank you for you answer Emmanuel.

I understand the problem with dual-licensing and copyright tranfert. I'll take under advisement the possibility of a CLA.
In the mean time i'm going to make my own lightweight QCPGraph as you suggest.