{"id":905,"date":"2011-12-12T19:02:54","date_gmt":"2011-12-12T18:02:54","guid":{"rendered":"http:\/\/kudzia.eu\/b\/?p=905"},"modified":"2011-12-13T08:22:03","modified_gmt":"2011-12-13T07:22:03","slug":"xmlencoder-java7","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2011\/12\/xmlencoder-java7\/","title":{"rendered":"java7, XMLEncoder problems"},"content":{"rendered":"<p>for the last few days i&#8217;ve been looking into java7&#8230; it surely seems faster. but also some of my old code broke when run under it.<br \/>\n<!--more--><br \/>\nfirst i&#8217;ve done unscientific benchmark to see &#8220;what&#8217;s in it for me&#8221; [what performance improvements does new jvm \/ new garbage collector bring]. most cpu-intensive part in my code is generation and parsing of xml that gets read from\/written to mysql. being a practical person [read: lazy] i googled for few minutes and found <a href=\"http:\/\/tedone.typepad.com\/blog\/2011\/06\/unmarshalling-benchmark-in-java-jaxb-vs-stax-vs-woodstox.html\">this benchmark<\/a>. i&#8217;ve run it few dozen of times on two different servers using identical data set. on each server i executed it using java 1.6.25 and 1.7.0_01. one machine was a 3 years old <a href=\"http:\/\/ark.intel.com\/products\/33087\/Intel-Xeon-Processor-X5460-(12M-Cache-3_16-GHz-1333-MHz-FSB)\">X5460<\/a> based server and another &#8211; a brand new box with <a href=\"http:\/\/ark.intel.com\/products\/52276\">E3-1270<\/a> inside. results:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/b\/wp-content\/uploads\/2011\/12\/chart.png\" alt=\"\" title=\"chart\" width=\"600\" height=\"371\" class=\"alignnone size-full wp-image-910\" srcset=\"https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2011\/12\/chart.png 600w, https:\/\/kudzia.eu\/b\/wp-content\/uploads\/2011\/12\/chart-300x185.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>more data: <a href=\"https:\/\/docs.google.com\/spreadsheet\/ccc?key=0Au9ThZ9PVUwldHpmQ3R3clQ2Y0ZBMlBWZzNOT3VXQWc\">here<\/a> and <a href='\/b\/wp-content\/uploads\/2011\/12\/xml_java1.6-1.7-benchmark.zip'>here<\/a>.<\/p>\n<p>unsurprising conclusion? it&#8217;s worth upgrading. my tests run ~10% faster under java7.<\/p>\n<p>but&#8230; i&#8217;ve stumbled on a problem: XMLEncoder in java7 seems to work differently than in the previous versions. it does not serialize to xml HashSet and possibly other properties of objects. i did not find anything reasonable on the net &#8211; just one <a href=\"http:\/\/wordrider.net\/forum\/read.php?7,8248,8251#msg-8251\">post<\/a> about similar issue. fortunately my xmls are short-lived [session data] so i have liberty of changing the data format whenever i need to. which i did &#8211; i started using <a href=\"http:\/\/xstream.codehaus.org\">xstream<\/a> for xml [de]serialization of objects.<\/p>\n<p>i&#8217;ve posted my problem at <a href=\"http:\/\/stackoverflow.com\/questions\/8474761\/change-of-behavior-of-xmlencoder-after-moving-from-java-1-6-x-to-1-7-x\">stackoverflow<\/a> but i did not get reply in the first few minutes, so most probably i&#8217;ll never get one.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>for the last few days i&#8217;ve been looking into java7&#8230; it surely seems faster. but also some of my old code broke when run under it.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[60,59],"class_list":["post-905","post","type-post","status-publish","format-standard","hentry","category-tech","tag-benchmarking","tag-java7"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=905"}],"version-history":[{"count":18,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/905\/revisions"}],"predecessor-version":[{"id":911,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/905\/revisions\/911"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}