XML or ValueTree


#1

Hi, I am in the process of creating a music library component using a TableListBox as the basis. So far I have it working using an XmlElement for its data in a similar way to the Juce demo. In other areas of my code I have been using ValueTrees and love them and I can’t help but think these would be a better replacement for the XML.

I was just wondering before I go to the effort of making the swap if there are any big speed differences between the two? There will be lots of searching and re-ordering etc going on.

Cheers, Dave.


#2

ValueTrees are definitely faster, and they store numeric values as numbers, not strings, so that’s faster and more accurate. I’d basically recommend using XML only for storage/retrieval/simple stuff, and ValueTrees if you’re doing a lot of mucking-around with the data.


#3

That’s what I thought, thanks a lot.


#4

Are they as fast as read a member variable with an inline member get function? in other words, is this:

As fast as:

Where


#5

No… how could it possibly be as fast as just reading a memory location!?!

(…and can everyone stop using that T() macro, please! It’s useless and I’m going to deprecate it at some point, so save yourself the hassle of typing it and just use a plain old string instead!)


#6

Ok! Thanks! you solved me two doubts in a row :wink: