/ Check-in [c43daa8c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Another (smaller) performance optimization for the JSON parser.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c43daa8c78df99f62dd4d3c83708a3a8eff92496
User & Date: drh 2015-09-24 01:40:45
Context
2015-09-24
11:06
Fix a JSON1 test case so that it works on builds that omit virtual tables. check-in: a4444c0f user: drh tags: trunk
01:40
Another (smaller) performance optimization for the JSON parser. check-in: c43daa8c user: drh tags: trunk
01:06
Performance optimizations on the JSON parser. check-in: 7dd4b07a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/json1.c.

   645    645   static int jsonParseValue(JsonParse *pParse, u32 i){
   646    646     char c;
   647    647     u32 j;
   648    648     int iThis;
   649    649     int x;
   650    650     JsonNode *pNode;
   651    651     while( safe_isspace(pParse->zJson[i]) ){ i++; }
   652         -  if( (c = pParse->zJson[i])==0 ) return 0;
   653         -  if( c=='{' ){
          652  +  if( (c = pParse->zJson[i])=='{' ){
   654    653       /* Parse object */
   655    654       iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0);
   656    655       if( iThis<0 ) return -1;
   657    656       for(j=i+1;;j++){
   658    657         while( safe_isspace(pParse->zJson[j]) ){ j++; }
   659    658         x = jsonParseValue(pParse, j);
   660    659         if( x<0 ){
................................................................................
   766    765       jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT,
   767    766                           j - i, &pParse->zJson[i]);
   768    767       return j;
   769    768     }else if( c=='}' ){
   770    769       return -2;  /* End of {...} */
   771    770     }else if( c==']' ){
   772    771       return -3;  /* End of [...] */
          772  +  }else if( c==0 ){
          773  +    return 0;   /* End of file */
   773    774     }else{
   774    775       return -1;  /* Syntax error */
   775    776     }
   776    777   }
   777    778   
   778    779   /*
   779    780   ** Parse a complete JSON string.  Return 0 on success or non-zero if there