You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by GitBox <gi...@apache.org> on 2022/01/05 18:13:59 UTC

[GitHub] [daffodil] stevedlawrence commented on a change in pull request #721: Support --infoset null for CLI unparsing

stevedlawrence commented on a change in pull request #721:
URL: https://github.com/apache/daffodil/pull/721#discussion_r779035698



##########
File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/infoset/NullInfosetInputter.scala
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.daffodil.infoset
+
+import java.io.InputStream
+
+import scala.collection.mutable.ArrayBuffer
+
+import scala.xml.Elem
+import scala.xml.Node
+import scala.xml.SAXParser
+import scala.xml.Text
+import scala.xml.XML
+
+import org.apache.daffodil.dpath.NodeInfo
+import org.apache.daffodil.infoset.InfosetInputterEventType._
+import org.apache.daffodil.util.MaybeBoolean
+import org.apache.daffodil.xml.DaffodilSAXParserFactory
+import org.apache.daffodil.xml.XMLUtils
+
+object NullInfosetInputter {
+
+  case class Event(
+    eventType: InfosetInputterEventType,
+    localName: String = null,

Review comment:
       I guess we could invent our own serialized form that could have ERD information and avoid that `nextElementEed()` overhead, but how practical is that in the real world? No other tools would know how to use this custom serialization, so being able to inspect/transform/validate it would be difficult. We would have to write custom tools to do all that, which seems like it removes the big benefit of Daffodil--that you can use a native serialization format that your inspect/transform/validate tools already understand and expect.
   
   Also, since all other InfosetInputter implementations other than this invented one would have this `nextElementErd()` overhead, it seems incorrect to exclude it from performance numbers. They will all  have this same `nextElementErd()` overhead (though, it should be a constant overhead regardless of `InfosetInputter` I think?).
   
   My goal here was have a way to exclude variances among different InfosetInputter implementations which can be wildly different (e.g. XMLTextInfosetInputter parsing text, SAXInfosetInputter threaded craziness, etc.). To me, this gives a good estimate of the fastest Daffodil can possible unparse. To go faster requires performance optimizations (like perhaps changing how `nextElementErd()` works).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org