Browse Source

Optimizing string conversion for integer values

Sebastien Ros 9 years ago
parent
commit
97e10ace08
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Jint/Native/Number/NumberPrototype.cs

+ 6 - 0
Jint/Native/Number/NumberPrototype.cs

@@ -281,6 +281,12 @@ namespace Jint.Native.Number
                 return "-" + ToNumberString(-m);
             }
 
+            var l = (long)m;
+            if(l == m)
+            {
+                return l.ToString(CultureInfo.InvariantCulture);
+            }
+
             // V8 FastDtoa can't convert all numbers, so try it first but
             // fall back to old DToA in case it fails
             var result = FastDtoa.NumberToString(m);