octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternati


From: anonymous
Subject: [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json
Date: Sat, 17 Oct 2020 08:45:25 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:81.0) Gecko/20100101 Firefox/81.0

Follow-up Comment #5, patch #9980 (project octave):

Also, I looked into 'jsonlab' a little more.  

- it looks like its designed to a specific data format 'JData',  developed by
the same author.
https://github.com/OpenJData/jdata/blob/master/JData_specification.md

- it's designed with a specific, matching parser in mind; one for python, none
for Javascript. Frankly, Octave-to-python seems moot because of NumPy. 
Javascript on the other hand...
https://github.com/fangq/jsonlab#sharing-jsonlab-created-data-files-in-python

> In short, to conveniently read/write data files created by 
> JSONLab into Python, whether they are JSON based or binary 
> JData/UBJSON based, one just need to download the below two 
> light-weight python modules

- like 'object2json', 'jsonlab' can be slow.  speed, for some reason, is
affected by ND array shape, not just size.  for example, on my desktop,
"savejson(rand(1000000,1))" takes 1sec but takes 500sec for either
"savejson(rand(1,1000000))"  or "savejson(rand(100,100,100))".  In contrast,
"toJSON" takes 1sec for all 3 shapes and maintains the respective shape within
the JSON file for straightforward parsing in Javascript and python (and
others).   

- "loadjson" while appearing to work with non-JData style JSON files, mangles
ND arrays similar to 'object2json'.  It assumes a strict FORTRAN style
indexing not used in Javascript or python (plain), which use the c-style array
indexing.  To be fair, "loadjson" is much faster than "fromJSON", presumably
due to it's use of metadata.



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9980>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]