Improve rune2symbol conversion

Change-Id: I431e8ed9f8166cbd5138a46ea5941242573ab219
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..9880f32
--- /dev/null
+++ b/Changes
@@ -0,0 +1,3 @@
+0.1.2 2021-12-05
+    - Improve performance of rune to symbol conversion in transduction
+      method.
diff --git a/datok.go b/datok.go
index ef3667b..0ffaac0 100644
--- a/datok.go
+++ b/datok.go
@@ -841,16 +841,19 @@
 					eot = true
 				}
 				a = dat.sigmaASCII[int(char)]
+
+				// Use identity symbol if character is not in sigma
+				if a == 0 && dat.identity != -1 {
+					a = dat.identity
+				}
+
 			} else {
 				a, ok = dat.sigma[char]
-				if !ok {
-					a = 0
-				}
-			}
 
-			// Use identity symbol if character is not in sigma
-			if a == 0 && dat.identity != -1 {
-				a = dat.identity
+				// Use identity symbol if character is not in sigma
+				if !ok && dat.identity != -1 {
+					a = dat.identity
+				}
 			}
 
 			t0 = t
diff --git a/datok_test.go b/datok_test.go
index 1beb9b7..d3de001 100644
--- a/datok_test.go
+++ b/datok_test.go
@@ -1078,7 +1078,12 @@
 //   BenchmarkDoubleArrayLarger-4                  16          71058822 ns/op         6357860 B/op       2577 allocs/op
 //   BenchmarkMatrixTransduce-4                 36703             31891 ns/op           28944 B/op         17 allocs/op
 // 2021-11-10 - rearranged longest match operator
-//   BenchmarkDoubleArrayTransduce-4    	   34522	     33210 ns/op	   28944 B/op	      17 allocs/op
-//   BenchmarkDoubleArrayConstruction-4   	   66990	     16012 ns/op	   10703 B/op	      29 allocs/op
-//   BenchmarkDoubleArrayLarger-4         	      16	  62829878 ns/op	 6357823 B/op	    2576 allocs/op
-//   BenchmarkMatrixTransduce-4           	   36154	     32702 ns/op	   28944 B/op	      17 allocs/op
+//   BenchmarkDoubleArrayTransduce-4            34522	             33210 ns/op          28944 B/op	      17 allocs/op
+//   BenchmarkDoubleArrayConstruction-4         66990              16012 ns/op          10703 B/op	      29 allocs/op
+//   BenchmarkDoubleArrayLarger-4                  16           62829878 ns/op        6357823 B/op	    2576 allocs/op
+//   BenchmarkMatrixTransduce-4                 36154              32702 ns/op          28944 B/op	      17 allocs/op
+// 2021-12-04 - optimize identity branch
+//   BenchmarkDoubleArrayTransduce-4            34903             32255 ns/op           28944 B/op         17 allocs/op
+//   BenchmarkDoubleArrayConstruction-4         79394             14561 ns/op           10703 B/op         29 allocs/op
+//   BenchmarkDoubleArrayLarger-4                  19          60257675 ns/op         6357911 B/op       2577 allocs/op
+//   BenchmarkMatrixTransduce-4                 35076             30581 ns/op           28944 B/op         17 allocs/op
diff --git a/matrix.go b/matrix.go
index 57f0c14..565de87 100644
--- a/matrix.go
+++ b/matrix.go
@@ -37,6 +37,10 @@
 		stateCount: auto.stateCount,
 	}
 
+	for i := 0; i < 256; i++ {
+		mat.sigmaASCII[i] = mat.identity
+	}
+
 	max := 0
 	for num, sym := range auto.sigmaRev {
 		if int(sym) < 256 {
@@ -399,16 +403,18 @@
 					eot = true
 				}
 				a = mat.sigmaASCII[int(char)]
+
+				if a == 0 && mat.identity != -1 {
+					a = mat.identity
+				}
+
 			} else {
 				a, ok = mat.sigma[char]
-				if !ok {
-					a = 0
-				}
-			}
 
-			// Use identity symbol if character is not in sigma
-			if a == 0 && mat.identity != -1 {
-				a = mat.identity
+				// Use identity symbol if character is not in sigma
+				if !ok && mat.identity != -1 {
+					a = mat.identity
+				}
 			}
 
 			t0 = t