summaryrefslogtreecommitdiff
path: root/libs/pbd/xml++.cc
AgeCommit message (Collapse)Author
2017-08-30Avoid assert() when loading xml: Throw an XMLerror if attribute_value fails.Ben Loftis
2017-05-29NO-OP: whitespaceRobin Gareus
2017-05-29duplicate routes start off unsoloed to avoid issues related to upstream / ↵Daniel Sheeler
downstream buses
2017-05-26Remove normalization of property names from libpbd xml codeTim Mayberry
It may have been OK to add this code temporarily at this low level, but as it was introduced in 2008, this change is made with the assumption that any Sessions that were affected have been re-saved since then with corrected property names and that "normalization" is no longer necessary. Timing results before changes: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 30375 Max: 48253 Total: 431727 Avg: 43172 (43 msecs) Write : Count: 10 Min: 42553 Max: 49163 Total: 453353 Avg: 45335 (45 msecs) Read : Count: 10 Min: 70307 Max: 75987 Total: 734923 Avg: 73492 (73 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 154486 Max: 307856 Total: 2678989 Avg: 267898 (267 msecs) Write : Count: 10 Min: 304273 Max: 343274 Total: 3169158 Avg: 316915 (316 msecs) Read : Count: 10 Min: 496920 Max: 541394 Total: 5260410 Avg: 526041 (526 msecs) Timing results after changes: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 21437 Max: 39749 Total: 348622 Avg: 34862 (34 msecs) Write : Count: 10 Min: 42320 Max: 49989 Total: 446135 Avg: 44613 (44 msecs) Read : Count: 10 Min: 63252 Max: 68389 Total: 660841 Avg: 66084 (66 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 113458 Max: 263225 Total: 2215595 Avg: 221559 (221 msecs) Write : Count: 10 Min: 305439 Max: 339986 Total: 3150697 Avg: 315069 (315 msecs) Read : Count: 10 Min: 447560 Max: 488121 Total: 4698903 Avg: 469890 (469 msecs)
2017-04-19Remove unused XMLNode::add_property methodsTim Mayberry
These are now unused and functionality is replaced by XMLNode::set_property set_property is a better name as a node can only have properties with unique names and the property will be set or reset(if it already exists). Changing the name also makes it easier to transition and test the new API.
2017-04-19Add a template based get/set_property API to PBD::XMLNodeTim Mayberry
2016-10-29Allow to construct a XML tree from a text bufferRobin Gareus
2016-10-10Use std::vector::reserve to improve performance of adding propertiesTim Mayberry
The number of properties per node roughly corresponds to the number of members of the class the node is representing and should be fairly low. Use std::vector::reserve to prevent reallocation on insert for most node types, there are exceptions like Region(~40 properties). This seems worth it as part(maybe 1/10th of the total time) of saving a Session is a combination of what occurs in "Create" and "Write" in this test. Perf results before changes: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 30610 Max: 42656 Total: 376672 Avg: 37667 (37 msecs) Write : Count: 10 Min: 42804 Max: 54277 Total: 460455 Avg: 46045 (46 msecs) Read : Count: 10 Min: 70364 Max: 85484 Total: 750909 Avg: 75090 (75 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 164360 Max: 356995 Total: 3064482 Avg: 306448 (306 msecs) Write : Count: 10 Min: 308655 Max: 372953 Total: 3226707 Avg: 322670 (322 msecs) Read : Count: 10 Min: 517243 Max: 541839 Total: 5289950 Avg: 528995 (528 msecs) Perf results after changes: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 30375 Max: 48253 Total: 431727 Avg: 43172 (43 msecs) Write : Count: 10 Min: 42553 Max: 49163 Total: 453353 Avg: 45335 (45 msecs) Read : Count: 10 Min: 70307 Max: 75987 Total: 734923 Avg: 73492 (73 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 154486 Max: 307856 Total: 2678989 Avg: 267898 (267 msecs) Write : Count: 10 Min: 304273 Max: 343274 Total: 3169158 Avg: 316915 (316 msecs) Read : Count: 10 Min: 496920 Max: 541394 Total: 5260410 Avg: 526041 (526 msecs)
2016-10-10Remove PropertyMap from XMLNode classTim Mayberry
It appears that there is no performance benefit from storing properties in a map for faster lookup or it is counteracted by the penalty of storing and maintaining the additional data structure. Timing results before changes with an optimized build: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 41293 Max: 63746 Total: 564448 Avg: 56444 (56 msecs) Write : Count: 10 Min: 42932 Max: 49221 Total: 453955 Avg: 45395 (45 msecs) Read : Count: 10 Min: 80160 Max: 84678 Total: 824506 Avg: 82450 (82 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 228759 Max: 420236 Total: 3587597 Avg: 358759 (358 msecs) Write : Count: 10 Min: 307095 Max: 348767 Total: 3205704 Avg: 320570 (320 msecs) Read : Count: 10 Min: 572400 Max: 657219 Total: 5959630 Avg: 595963 (595 msecs) Perf results after changes: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 30610 Max: 42656 Total: 376672 Avg: 37667 (37 msecs) Write : Count: 10 Min: 42804 Max: 54277 Total: 460455 Avg: 46045 (46 msecs) Read : Count: 10 Min: 70364 Max: 85484 Total: 750909 Avg: 75090 (75 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 164360 Max: 356995 Total: 3064482 Avg: 306448 (306 msecs) Write : Count: 10 Min: 308655 Max: 372953 Total: 3226707 Avg: 322670 (322 msecs) Read : Count: 10 Min: 517243 Max: 541839 Total: 5289950 Avg: 528995 (528 msecs)
2016-10-10Use references rather than copying containers in libpbd xml codeTim Mayberry
It is slightly surprising but there seems to be little difference to performance with these changes. Possibly a slight improvement in "Create" test with a large xml document(~5%). Timing results before these changes with an optimized build using new XML perf tests: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 38656 Max: 63827 Total: 571228 Avg: 57122 (57 msecs) Write : Count: 10 Min: 43594 Max: 49279 Total: 459907 Avg: 45990 (45 msecs) Read : Count: 10 Min: 80247 Max: 84912 Total: 827207 Avg: 82720 (82 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 230706 Max: 456054 Total: 3850998 Avg: 385099 (385 msecs) Write : Count: 10 Min: 312322 Max: 353789 Total: 3264211 Avg: 326421 (326 msecs) Read : Count: 10 Min: 573556 Max: 610865 Total: 5951908 Avg: 595190 (595 msecs) Timing results after these changes: XMLTest::testPerfMediumXMLDocumentTiming Create : Count: 10 Min: 41293 Max: 63746 Total: 564448 Avg: 56444 (56 msecs) Write : Count: 10 Min: 42932 Max: 49221 Total: 453955 Avg: 45395 (45 msecs) Read : Count: 10 Min: 80160 Max: 84678 Total: 824506 Avg: 82450 (82 msecs) XMLTest::testPerfLargeXMLDocumentTiming Create : Count: 10 Min: 228759 Max: 420236 Total: 3587597 Avg: 358759 (358 msecs) Write : Count: 10 Min: 307095 Max: 348767 Total: 3205704 Avg: 320570 (320 msecs) Read : Count: 10 Min: 572400 Max: 657219 Total: 5959630 Avg: 595963 (595 msecs)
2016-10-10Add XMLNode::operator==/!=() for comparing XMLNode instancesTim Mayberry
Implemented to be able to test that when writing an XML document via XMLTree and then reading back into another XMLTree the structure is equivalent as a general API test of pbd/xml++.h to check for breakage when changing implementation.
2016-05-04OMNIBUS COMMIT: prefer const XMLNode::property method (and provide a real one)Paul Davis
2016-05-03add a const method to check for existing key/value propertiesRobin Gareus
handy to lookup up XMLNodes with "id" == ID w/o allocating memory.
2016-04-08Revert "experimental session-save speedup" -- needs C++11Robin Gareus
This reverts commit d1dcedaccfd5adfd661724476003410d5d251756.
2016-04-08more potential session-save speedup.Robin Gareus
std:vector trumps std::list speed in all aspects: traversal, insertion (at end) and Deletion. ..but we'll have to be careful about iterators..
2016-04-08experimental session-save speedupRobin Gareus
property order is not important, unordered_map lookup and insertion is O(1)
2015-10-07allow to load huge VST plugin states -fixes #6623Robin Gareus
by default libxml has a XML_MAX_TEXT_LENGTH of 10M with base64 encoding that allows at most 2.5MB state. set XML_PARSE_HUGE to read large sessions
2015-10-05NOOP, remove trailing tabs/whitespace.Robin Gareus
2015-10-04globally remove all trailing whitespace from ardour code base.Paul Davis
Paul Davis was responsible for introducing almost all of this.
2015-07-25Revert "When saving a session (in a non-English locale) make sure that we ↵Tim Mayberry
use a locale-specific path" This reverts commit cf5a8651d848fa5333e1c567286fc0eec2b0a0f7.
2015-07-23When saving a session (in a non-English locale) make sure that we use a ↵John Emmas
locale-specific path
2014-07-05debug info to trace down "cannot rename temp session file" errorsRobin Gareus
..but actually, the real error may be concurrent calls to Session::save_state()
2013-07-17Remaining changes needed for building libpdb on Windows (except for adding ↵John Emmas
the extra JE source modules)
2013-03-30Fix some compilation warningsJulien de Kozak
2012-08-10add -Wpointer-arith -Wcast-qual -Wcast-align and others to compile flags, ↵Paul Davis
and fix const cast warnings generated by new flags git-svn-id: svn://localhost/ardour2/branches/3.0@13124 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23Fix build.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@12910 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23Remove unnecessary header includesTim Mayberry
git-svn-id: svn://localhost/ardour2/branches/3.0@12827 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-16Add new SharedStatefulProperty which manages a shared_ptr toCarl Hetherington
some Stateful object, and a subclass to use this for AutomationList. SharedStatefulProperty will manage undo / redo using full copies of the XML state, like MementoCommand, but does it within the Property undo system. git-svn-id: svn://localhost/ardour2/branches/3.0@12740 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-03-20some deep changes to xml++ in which we retain a C-level xmlDocPtr as a ↵Paul Davis
member of an XMLTree objects. this allows us to do repeated XPATH searches (as in the midnam parser of libmidi++) without constantly rewriting an entire tree into memory to recreate a new xmlDocPtr with which we can search. Since XMLTree objects don't typically stay around for very long, just when serializing to/from disk, this is not anticipated to have much (if any) impact on memory consumption git-svn-id: svn://localhost/ardour2/branches/3.0@11733 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-03-07implement XMLNode::operator=() as a deep operation with the same semantics ↵Paul Davis
as the XMLNode copy constructor. attempt to share as much code as possible between them and the destructor git-svn-id: svn://localhost/ardour2/branches/3.0@11612 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-11-16Slightly unpleasant fix for creation of tracks fromCarl Hetherington
templates; it would be nice if we could set things up using the Route's logic for setting names of its children, rather than repeating the same logic in XML-land (#4303). git-svn-id: svn://localhost/ardour2/branches/3.0@10655 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-03-12make XMLNode::add_property() correctly re-entrant and reduce the size of the ↵Paul Davis
tmp buffer used to print a long integer git-svn-id: svn://localhost/ardour2/branches/3.0@9131 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-03-12a better fix fpr that wierd XMLProperty botchPaul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@9128 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-09-03Rename debug -> dumpCarl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@7738 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-05-09Add debug() method to dump XML nodes.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@7083 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-03-25Remove use of xmlCleanupParser as suggested in the libxml2 docs. Fixes #3047.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@6793 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-10-20Since add_property creates new XMLProperty objects, remove_property should ↵Carl Hetherington
probably delete them. Although remove_property is only used in one place in Ardour that I can see. git-svn-id: svn://localhost/ardour2/branches/3.0@5824 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-10-02Fix some trivial compiler warnings and add editor_imageframe.cc to ↵Sakari Bergen
gtk2_ardour/wscript git-svn-id: svn://localhost/ardour2/branches/3.0@5716 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-12Remove most using declarations from header files.Carl Hetherington
git-svn-id: svn://localhost/ardour2/branches/3.0@5069 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-02-25*** NEW CODING POLICY ***David Robillard
All #include statements that include a header that is a part of a library bundled with ardour MUST use quotes, not angle brackets. Do this: #include "ardour/types.h" NOT this: #include <ardour/types.h> Rationale: This is best practice in general, to ensure we include the local version and not the system version. That quotes mean "local" (in some sense) and angle brackets mean "system" (in some sense) is a ubiquitous convention and IIRC right in the C spec somewhere. More pragmatically, this is required by (my) waf (stuff) for dependencies to work correctly. That is: !!! FAILURE TO DO THIS CAN RESULT IN BROKEN BUILDS !!! Failure to comply is punishable by death by torture. :) P.S. It's not that dramatic in all cases, but this (in combination with some GCC flags specific to the include type) is the best way I have found to be absolutely 100% positive the local ones are being used (and we definitely want to be absolutely 100% positive on that one). git-svn-id: svn://localhost/ardour2/branches/3.0@4655 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-02-22Clean up xml++.h and xml++.cc in Ardour style.David Robillard
No functional changes. (We've diverged far enough for it to not matter, and are about to diverge even more, so might as well). git-svn-id: svn://localhost/ardour2/branches/3.0@4649 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-12-18Remove unnecessary 0 checks before delete; see ↵Carl Hetherington
http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.8 Apologies for the big commit. git-svn-id: svn://localhost/ardour2/branches/3.0@4332 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-10-05Normalize XML property name style, preserving old session loading (on load _ ↵David Robillard
will be converted to -). Still to go: Non-consistent PBD tag names, colours. git-svn-id: svn://localhost/ardour2/branches/3.0@3872 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-09-10merge 2.0-ongoing into 3.0 @ 3581 - 3710Paul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@3712 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02rollback to 3428, before the mysterious removal of libs/* at 3431/3432Paul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02remove empty sigc++2 directoryDoug McLain
git-svn-id: svn://localhost/ardour2/branches/3.0@3432 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-25* splitted midi++/event.h in header and implementationHans Baier
* added to_string(), to_xml() and from_xml() to MIDI::Event * added partial support for midnam-Patchfiles (http://www.sonosphere.com/dtds/MIDINameDocument.dtd): midnam_patch.h/.cc * added validation support to xml++.cc/.h * added XMLNode::add_property(const char *name, const long value) * added test to pbd/tests/xpath.cc git-svn-id: svn://localhost/ardour2/branches/3.0@3412 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-23* added midnam test file for xpathHans Baier
* added to_string() to MIDI::Event * added XMLNode::attribute_value for attribute nodes * debugging output in MidiModel (incorrect rendering of Pitchbender events: Notes lost * added xpath tests for midnam files git-svn-id: svn://localhost/ardour2/branches/3.0@3406 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-23* changed return type for pbd/xml++ xpath support to use boost::shared_ptrHans Baier
git-svn-id: svn://localhost/ardour2/branches/3.0@3402 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-22* added XPath support to pbd/xml++Hans Baier
git-svn-id: svn://localhost/ardour2/branches/3.0@3384 d708f5d6-7413-0410-9779-e7cbd77b26cf