13
0
Commit Graph

52 Commits

Author SHA1 Message Date
06700cb2f4 Allow to construct a XML tree from a text buffer 2016-10-29 19:57:43 +02:00
816f3bfb36 Use std::vector::reserve to improve performance of adding properties
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-10 08:45:34 +10:00
e84fbfe6e5 Remove PropertyMap from XMLNode class
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-10 08:45:34 +10:00
97752e6a51 Use references rather than copying containers in libpbd xml code
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-10 08:45:34 +10:00
4b2987d0f2 Add XMLNode::operator==/!=() for comparing XMLNode instances
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-10-10 08:45:34 +10:00
17ace643e4 OMNIBUS COMMIT: prefer const XMLNode::property method (and provide a real one) 2016-05-04 23:09:45 -04:00
255b5174c4 add a const method to check for existing key/value properties
handy to lookup up XMLNodes with "id" == ID w/o allocating memory.
2016-05-03 03:03:00 +02:00
ff05c82312 Revert "experimental session-save speedup" -- needs C++11
This reverts commit d1dcedaccf.
2016-04-08 21:21:38 +02:00
3def1b2830 more potential session-save speedup.
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-08 21:03:23 +02:00
d1dcedaccf experimental session-save speedup
property order is not important,
unordered_map lookup and insertion is O(1)
2016-04-08 20:32:49 +02:00
14932d1b86 allow to load huge VST plugin states -fixes #6623
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-07 14:36:32 +02:00
22b07e0233 NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
4dc63966f0 globally remove all trailing whitespace from ardour code base.
Paul Davis was responsible for introducing almost all of this.
2015-10-04 14:51:05 -04:00
44cba53219 Revert "When saving a session (in a non-English locale) make sure that we use a locale-specific path"
This reverts commit cf5a8651d8.
2015-07-25 23:14:50 +10:00
cf5a8651d8 When saving a session (in a non-English locale) make sure that we use a locale-specific path 2015-07-23 17:55:13 +01:00
c9b0f0fcb7 debug info to trace down "cannot rename temp session file" errors
..but actually, the real error may be concurrent
calls to Session::save_state()
2014-07-05 20:53:22 +02:00
350ed31655 Remaining changes needed for building libpdb on Windows (except for adding the extra JE source modules) 2013-07-17 08:08:46 +01:00
Julien de Kozak
27d77b8719 Fix some compilation warnings 2013-03-30 18:09:40 +01:00
760ccbabfb add -Wpointer-arith -Wcast-qual -Wcast-align and others to compile flags, 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-08-10 15:57:09 +00:00
Carl Hetherington
e58e614f20 Fix build.
git-svn-id: svn://localhost/ardour2/branches/3.0@12910 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23 12:54:11 +00:00
6262eae7c0 Remove unnecessary header includes
git-svn-id: svn://localhost/ardour2/branches/3.0@12827 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-06-23 03:51:41 +00:00
Carl Hetherington
5ac22e9095 Add new SharedStatefulProperty which manages a shared_ptr to
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-06-16 17:20:10 +00:00
71b3c8cfe1 some deep changes to xml++ in which we retain a C-level xmlDocPtr as a 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-20 18:01:07 +00:00
3c7f9586ae implement XMLNode::operator=() as a deep operation with the same semantics 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
2012-03-07 02:07:35 +00:00
Carl Hetherington
0c9c47086c Slightly unpleasant fix for creation of tracks from
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-11-16 23:03:59 +00:00
72928df58f make XMLNode::add_property() correctly re-entrant and reduce the size of the 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-12 20:29:40 +00:00
58ce6c2bb7 a better fix fpr that wierd XMLProperty botch
git-svn-id: svn://localhost/ardour2/branches/3.0@9128 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-03-12 20:23:56 +00:00
Carl Hetherington
8778724701 Rename debug -> dump
git-svn-id: svn://localhost/ardour2/branches/3.0@7738 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-09-03 15:24:21 +00:00
Carl Hetherington
542372cd18 Add debug() method to dump XML nodes.
git-svn-id: svn://localhost/ardour2/branches/3.0@7083 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-05-09 00:46:33 +00:00
Carl Hetherington
896aa29dcf Remove use of xmlCleanupParser as suggested in the libxml2 docs. Fixes #3047.
git-svn-id: svn://localhost/ardour2/branches/3.0@6793 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-03-25 01:24:59 +00:00
Carl Hetherington
271f298635 Since add_property creates new XMLProperty objects, remove_property should 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-20 18:44:44 +00:00
Sakari Bergen
1928f286e9 Fix some trivial compiler warnings and add editor_imageframe.cc to gtk2_ardour/wscript
git-svn-id: svn://localhost/ardour2/branches/3.0@5716 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-10-02 11:16:15 +00:00
Carl Hetherington
3b89d9eaa0 Remove most using declarations from header files.
git-svn-id: svn://localhost/ardour2/branches/3.0@5069 d708f5d6-7413-0410-9779-e7cbd77b26cf
2009-05-12 17:03:42 +00:00
e0aaed6d65 *** NEW CODING POLICY ***
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-25 18:26:51 +00:00
c9e5903e73 Clean up xml++.h and xml++.cc in Ardour style.
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
2009-02-22 20:52:34 +00:00
Carl Hetherington
4e1f451520 Remove unnecessary 0 checks before delete; see 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-12-18 19:31:00 +00:00
6b0d22268b Normalize XML property name style, preserving old session loading (on load _ 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-10-05 23:14:48 +00:00
c86210a9d5 merge 2.0-ongoing into 3.0 @ 3581 - 3710
git-svn-id: svn://localhost/ardour2/branches/3.0@3712 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-09-10 21:27:39 +00:00
449aab3c46 rollback to 3428, before the mysterious removal of libs/* at 3431/3432
git-svn-id: svn://localhost/ardour2/branches/3.0@3435 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 21:41:35 +00:00
Doug McLain
9c0d7d72d7 remove empty sigc++2 directory
git-svn-id: svn://localhost/ardour2/branches/3.0@3432 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-06-02 05:02:28 +00:00
Hans Baier
911c5717bc * splitted midi++/event.h in header and implementation
* 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-25 23:35:23 +00:00
Hans Baier
4aa9d17ab1 * added midnam test file for xpath
* 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 10:36:51 +00:00
Hans Baier
1401a52764 * changed return type for pbd/xml++ xpath support to use boost::shared_ptr
git-svn-id: svn://localhost/ardour2/branches/3.0@3402 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-23 00:52:25 +00:00
Hans Baier
376263d925 * added XPath support to pbd/xml++
git-svn-id: svn://localhost/ardour2/branches/3.0@3384 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-05-22 12:06:20 +00:00
1b65758557 Committed underlay support (from Audun).
git-svn-id: svn://localhost/ardour2/branches/3.0@3037 d708f5d6-7413-0410-9779-e7cbd77b26cf
2008-02-10 18:16:25 +00:00
ca49f7cba7 fix audio clock restore, provide XMLNode::property (string) and speed up the property methods by not scanning the map twice. sorry about the recompile
git-svn-id: svn://localhost/ardour2/trunk@1286 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-01-08 20:51:26 +00:00
Taybin Rutkin
bf9c767581 Ardour session files specify UTF-8.
git-svn-id: svn://localhost/ardour2/trunk@1062 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-11-02 21:30:42 +00:00
Taybin Rutkin
d99758ff37 Small removal of unnecessary code.
git-svn-id: svn://localhost/ardour2/trunk@1036 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-10-31 16:12:05 +00:00
71c94e6943 massive changes in automation state handling, not entirely complete; some bug fixes for automation line drawing
git-svn-id: svn://localhost/ardour2/trunk@1034 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-10-31 02:40:08 +00:00
Taybin Rutkin
3a5a338f80 Fixed double delete in Stateful::add_instant_xml().
git-svn-id: svn://localhost/ardour2/trunk@690 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-07-22 16:21:10 +00:00