mORMot and Open Source friends
Check-in [85c06e2619]
Not logged in

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

Overview
Comment:enable "rowCount":... speedup on the Delphi client side - now our regression tests about 4 KB of content request were speed up from 40,0000 requests per second to 60,000 requests per second!
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 85c06e261999d6c9e286abb9d43da59c411c87af
User & Date: abouchez 2013-03-19 12:41:06
Context
2013-03-19
16:24
  • "rowCount":... field will now be generated even for 0 and 1 values, to ensure perfect consistency when consummed from an AJAX request;
  • TSQLPropInfoList search by field name will use fast binary search instead of O(n) linear search
check-in: 900703f728 user: abouchez tags: trunk
12:41
enable "rowCount":... speedup on the Delphi client side - now our regression tests about 4 KB of content request were speed up from 40,0000 requests per second to 60,000 requests per second! check-in: 85c06e2619 user: abouchez tags: trunk
10:33
new optional "rowCount":... field value is added in TSQLRestServerStaticInMemory.GetJSONValues, TSQLTable.GetJSONValues, TSQLTableJSON.ParseAndConvert, TSQLRequest.Execute and TSQLDBStatement.FetchAllToJSON methods at the end of the non expanded JSON conten - improves client JSON parsing performance, especially in case of huge content check-in: 760c6e358d user: abouchez tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/mORMot.pas.

15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
function IsNotAjaxJSON(P: PUTF8Char): Boolean;
begin
  result := Expect(P,'{"fieldCount":');
end;

function IsNotExpanded(var P: PUTF8Char; PEnd: PUTF8Char;
  var FieldCount,RowCount: integer): boolean;
const ROWCOUNTFIELD: PUTF8Char = '"rowCount":';
var i: integer;
begin
  if not Expect(P,'{"fieldCount":') then begin
    result := false;
    exit;
  end;
  FieldCount := GetJSONIntegerVar(P);
  if Expect(P,',"rowCount":') then
    RowCount := GetJSONIntegerVar(P) else begin
    RowCount := 0;
    if (PEnd<>nil) and (PEnd-P>24) then
      for i := 1 to 24 do // search for "rowCount": at the end of the JSON buffer
      case PEnd[-i] of
      ']': break;
      '}': break;
      ',': begin
        if CompareMem(PEnd-i+1,ROWCOUNTFIELD,11) then
          RowCount := GetCardinal(PEnd-i+12);
        break;
      end;
      end;
  end;
  result := (FieldCount<>0) and Expect(P,',"values":[');
end;







|













<
|
|
|
|







15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315

15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
function IsNotAjaxJSON(P: PUTF8Char): Boolean;
begin
  result := Expect(P,'{"fieldCount":');
end;

function IsNotExpanded(var P: PUTF8Char; PEnd: PUTF8Char;
  var FieldCount,RowCount: integer): boolean;
const ROWCOUNTFIELD: PUTF8Char = ',"rowCount":';
var i: integer;
begin
  if not Expect(P,'{"fieldCount":') then begin
    result := false;
    exit;
  end;
  FieldCount := GetJSONIntegerVar(P);
  if Expect(P,',"rowCount":') then
    RowCount := GetJSONIntegerVar(P) else begin
    RowCount := 0;
    if (PEnd<>nil) and (PEnd-P>24) then
      for i := 1 to 24 do // search for "rowCount": at the end of the JSON buffer
      case PEnd[-i] of

      ']',',': break;
      ':': begin
        if CompareMem(PEnd-i-11,ROWCOUNTFIELD,11) then
          RowCount := GetCardinal(PEnd-i+1);
        break;
      end;
      end;
  end;
  result := (FieldCount<>0) and Expect(P,',"values":[');
end;