diff --git a/uppdev/XmlNodeFilter/XmlNodeFilter.cpp b/uppdev/XmlNodeFilter/XmlNodeFilter.cpp new file mode 100644 index 000000000..9dd0c5160 --- /dev/null +++ b/uppdev/XmlNodeFilter/XmlNodeFilter.cpp @@ -0,0 +1,55 @@ +#include + +using namespace Upp; + +void MakeMap(VectorMap& map, const XmlNode& n, const String& path, int& tag_count) +{ + if(map.GetCount() > 1000) + return; + for(int i = 0; i < n.GetCount(); i++) { + if(n[i].IsTag()) { + map.GetAdd(path, 0)++; + MakeMap(map, n[i], path + "/" + n[i].GetTag(), tag_count); + tag_count++; + } + } +} + +void DumpMap(const XmlNode& n) +{ + VectorMap map; + int tag_count = 0; + MakeMap(map, n, String(), tag_count); + SortByKey(map); + DUMPM(map); + DUMP(tag_count); +} + +//const char *xmlfile = "/home/cxl/20131117_ST_ZZSZ.xml"; +const char *xmlfile = "/home/cxl/20131106_ST_ZZSZ.xml"; + +CONSOLE_APP_MAIN +{ + RLOG(MemoryProfile()); + { + RTIMING("Parse with ignore!"); + IgnoreXmlPaths ignore("/vf:VymennyFormat/vf:Data/vf:AdresniMista/vf:AdresniMisto/ami:Geometrie;/vf:VymennyFormat/vf:Data/vf:Parcely"); + XmlNode n = ParseXML(LoadFile(xmlfile), ignore); + RLOG("-----------"); + RLOG("With ignore"); + RLOG(MemoryUsedKb() << " KB used -------"); + RLOG(MemoryProfile()); + DumpMap(n); + } + { + RTIMING("Parse all!"); + XmlNode n = ParseXML(LoadFile(xmlfile)); + RLOG("-----------"); + RLOG("ALL"); + RLOG(MemoryUsedKb() << " KB used -------"); + RLOG(MemoryProfile()); + DumpMap(n); + } + RLOG("-----------"); + RLOG(MemoryProfile()); +} diff --git a/uppdev/XmlNodeFilter/XmlNodeFilter.upp b/uppdev/XmlNodeFilter/XmlNodeFilter.upp new file mode 100644 index 000000000..8922abb6d --- /dev/null +++ b/uppdev/XmlNodeFilter/XmlNodeFilter.upp @@ -0,0 +1,10 @@ +uses + Core; + +file + XmlNodeFilter.cpp, + info.txt; + +mainconfig + "" = "SSE2"; + diff --git a/uppdev/XmlNodeFilter/info.txt b/uppdev/XmlNodeFilter/info.txt new file mode 100644 index 000000000..12ea9b0de --- /dev/null +++ b/uppdev/XmlNodeFilter/info.txt @@ -0,0 +1,9 @@ +39460 KB used ------- +TIMING Parse! : 147.00 ms - 147.00 ms (147.00 ms / 1 ), min: 147.00 ms, max: 147.00 ms, nesting: 1 - 1 + +======================= +----------- +40484 KB used ------- +TIMING Parse! : 152.00 ms - 152.00 ms (152.00 ms / 1 ), min: 152.00 ms, max: 152.00 ms, nesting: 1 - 1 + +======================= diff --git a/uppdev/XmlNodeFilter/init b/uppdev/XmlNodeFilter/init new file mode 100644 index 000000000..0eca3a652 --- /dev/null +++ b/uppdev/XmlNodeFilter/init @@ -0,0 +1,4 @@ +#ifndef _XmlNodeFilter_icpp_init_stub +#define _XmlNodeFilter_icpp_init_stub +#include "Core/init" +#endif diff --git a/uppdev/telupp/telupp.cpp b/uppdev/telupp/telupp.cpp index 7221a812b..0aff8dfeb 100644 --- a/uppdev/telupp/telupp.cpp +++ b/uppdev/telupp/telupp.cpp @@ -85,7 +85,7 @@ CONSOLE_APP_MAIN { // StdLogSetup(LOG_COUT|LOG_FILE); - if(!server.Listen(80, 10)) { + if(!server.Listen(8000, 10)) { LOG("Cannot open server port for listening\r\n"); return; }