Dear All,
On my old i7 quadcore, the below loop made for testing takes 44 seconds to run through 100 mio. times:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Whereas the more "manual" approach below takes only 9 seconds:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Can I conclude, based on the above, that JSON is not very efficient on parsing (at least short) inputs in comparison to using the Substring function, or is there a more efficient way of doing it with JSON than this?
This matters to me when 100´s of strings need to be parsed every second.
My JSON library version is 1.21.
			
			On my old i7 quadcore, the below loop made for testing takes 44 seconds to run through 100 mio. times:
			
				B4X:
			
		
		
		Log (DateTime.Time(DateTime.Now))
    For i = 0 To 100000000
    Dim JSON As JSONParser
    Dim str2 As String = $"{"a":"1","b":"2","c":"3"}"$
    JSON.Initialize(str2)
    Dim M As Map = JSON.NextObject
    Dim a As String = (M.Get ("a"))
    Dim b As String = (M.Get ("b"))
    Dim c As String = (M.Get ("c"))
    Next
    Log (DateTime.Time(DateTime.Now))
	Whereas the more "manual" approach below takes only 9 seconds:
			
				B4X:
			
		
		
		Log (DateTime.Time(DateTime.Now))
    For i = 0 To 100000000
    
        Dim str2 As String = $"{"a":"1","b":"2","c":"3"}"$
        Dim a As String = str2.SubString2 (str2.IndexOf ($""a""$) + 5,str2.IndexOf2 ($"","$, str2.IndexOf ($","a""$)))
        Dim b As String = str2.SubString2 (str2.IndexOf ($""b""$) + 5,str2.IndexOf2 ($"","$, str2.IndexOf ($","b""$)))
        Dim c As String = str2.SubString2 (str2.IndexOf ($""c""$) + 5,str2.IndexOf2 ($""}"$, str2.IndexOf ($","c""$)))
        
    Next
    Log (DateTime.Time(DateTime.Now))
	Can I conclude, based on the above, that JSON is not very efficient on parsing (at least short) inputs in comparison to using the Substring function, or is there a more efficient way of doing it with JSON than this?
This matters to me when 100´s of strings need to be parsed every second.
My JSON library version is 1.21.