JSON parser JsonDataObjects is now on GitHub

  • 主题发起人 主题发起人 Andreas Hausladen
  • 开始时间 开始时间
A

Andreas Hausladen

Unregistered / Unconfirmed
GUEST, unregistred user!
It all started with a new DDevExtensions feature I’m working on, or was working on before my JSON parser project took over. For this new feature I needed to write and read some information to and from a file. XML was out of question, so I came up with a “one line per entry” format. As the feature grew I “suddenly” needed to write more structured data. After trying to do that in a “one line per entry” format the I/O code became such a mess that I deleted it and came up with the idea to use JSON for the file.

After browsing the web and looking into the different JSON parsers for Delphi, I decided that I didn’t need such complicated and feature rich parsers and it would be fun to write my own parser. So I started, not knowing that my class names would be the same of Delphi’s JSON parser, because I never looked into it before I started benchmarking my parser against it.

And here we are. The DDevExtensions feature is on halt and my brand new JSON parser is available on GitHub. It uses a lot of low level tricks to get as much performance out of the different Delphi compilers and RTL and beats Delphi’s JSON parser in performance and memory usage, by far.

Features

  • Fast dual JSON parser for parsing UTF8 and UTF16 without conversion
  • Automatic creation of arrays and objects
  • Easy access mode with implicit operators
  • Compact and formatted output modes
  • Win32, Win64 and ARM Android support (MacOS and iOS may work)
  • Supports Delphi 2009-XE7
Some internal tricks:

  • Elimination of unnecessary _UStrAsg and _UStrClr calls, reduces CPU locks
  • ARC: Faster ARC handling by doing it by hand without the virtual method calls (RSP-9712)
  • Storing string literals where possible instead of creating a heap string for them
  • Caching the last string literal pointer for faster repeated name access. Broken in XE7 (RSP-10015)
  • Specialized own StringBuilder implementation that doesn’t need to copy the buffer to the final string
  • Fast String to Int64 conversion implemented in assembler for x86 and x64
  • Fast String to Double conversion

查看更多...
 

Similar threads

A
回复
0
查看
943
Andreas Hausladen
A
A
回复
0
查看
413
Andreas Hausladen
A
A
回复
0
查看
992
Andreas Hausladen
A
A
回复
0
查看
619
Andreas Hausladen
A
A
回复
0
查看
819
Andreas Hausladen
A
后退
顶部