Skip to content

Delphi's JSON implementation is very veryl slow, why don't use JsonDataObjects? #46

@Delphi-FPC-Lazarus

Description

@Delphi-FPC-Lazarus

Hi,

while testing I did some measurement to find out why communication is so slow.
I figured out that the problem is related to JSON cause delphi's json implemation is using strings (copy) everywhere, that's the main problem.
After changing code using JsonDataObjects (https://github.com/ahausladen/JsonDataObjects) json part is runing up to 20 times (!!!) faster.

You should test and think about if it would be an option to use alternate framework or maybe directly integrate on \dist.

regards,
peter

internal note:
seems like delay on processing is related to object overhead on client side
=> BASE64 decode encode is very fast
=> writing Json is very fast
=> But reading json (json.parse) takes most of that time (23ms for 200kb JSON), when trying to process bigger JSON time is exploding
why? very bad implementation, working with strings everywhere instead of pchar, complex object structure.
replacement: https://github.com/ahausladen/JsonDataObjects recommended, looks like it is reading same json 20 times faster...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions