diff Implab/Formats/InputScanner.cs @ 229:5f7a3e1d32b9 v2

JsonXmlReader performance tuning JsonScanner now operates strings and doesn't parses number and literals. Added SerializationHelpers to common serialize/deserialize operations
author cin
date Tue, 12 Sep 2017 19:07:42 +0300
parents 6fa235c5a760
children 302ca905c19e
line wrap: on
line diff
--- a/Implab/Formats/InputScanner.cs	Tue Sep 12 01:19:12 2017 +0300
+++ b/Implab/Formats/InputScanner.cs	Tue Sep 12 19:07:42 2017 +0300
@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Runtime.CompilerServices;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -30,24 +31,28 @@
         }
 
         public TTag Tag {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
             get {
                 return m_tags[m_state];
             }
         }
 
         public int Position {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
             get {
                 return m_position;
             }
         }
 
         public bool IsFinal {
+            [MethodImpl(MethodImplOptions.AggressiveInlining)]
             get {
                 return m_final[m_state];
             }
         }
 
-        public void Reset() {
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public void ResetState() {
             m_state = m_initialState;
         }
 
@@ -58,13 +63,8 @@
             return clone;
         }
 
-        public bool Scan(char[] data, int offset, int length) {
-            if (length <= 0) {
-                m_position = offset;
-                return false; // EOF
-            }
-
-            var max = offset + length;
+        //[MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public bool Scan(char[] data, int offset, int max) {
             var next = m_state;
 
             while(offset < max) {