there is this lightweight version than can store any boxable content with a key, and so suitable for json-like storage. meant to be convenient rather than fast.
http://www.jsoftware.com/pipermail/programming/2013-September/033494.html another approach would be to use a numbered locale dict =. 18!:3 (or cocreate) '' key1__dict =: value1 key1__dict NB. retrieves value1 d=. cocreate '' key1__d =:2 key2__d =:3 names__d '' key1 key2 loc=: (,&'_'@[ ,&'_'@, ":@>@])"1 0 ; ". each ((;: names__d'') loc each d) 2 3 ; used just for email display. If content can be of mixed type, then it would fail. limitation is that keys are limited to valid variable/assign names. If you derived from a class that contained methods listkeys, listvalues, then those key names would break the code. ----- Original Message ----- From: Yike Lu <yikelu.h...@gmail.com> To: programm...@jsoftware.com Cc: Sent: Monday, March 3, 2014 10:06:00 AM Subject: Re: [Jprogramming] Sorry state of slow parsing of JSON in J A tangential but related question: does J have a dictionary data type? Where can I read about it? Thanks. On Mon, Mar 3, 2014 at 8:55 AM, Tracy Harms <kalei...@gmail.com> wrote: > My naïve intuition is that a tree of symbols would be the most direct route > to increased performance. Would that fit with what you suggested here, > Raul? > On Mar 3, 2014 1:52 AM, "Raul Miller" <rauldmil...@gmail.com> wrote: > > > We should be able to concatenate boxed arrays with somewhat better > > performance. Conceptually speaking, the added box can be treated as an > > opaque string (other than reference counting bumps) for the purpose of > the > > concatenation operation. Conceptually, also, already have some way of > > allocating memory in "power of two sized blocks". But memory management > is > > a subtle thing, so maybe there is something I am missing? > > > > Thanks, > > > > -- > > Raul > > > > > > On Mon, Mar 3, 2014 at 12:26 AM, bill lam <bbill....@gmail.com> wrote: > > > > > I would be quite happy if J can do that in a few minutes. The > > > bottle neck is not string related but J converts Json data into a > > > box array. Because concatenation of box arrays cannot be done > > > in place, it re-constructs a new box array for each node and this > > > is quadratic. > > > > > > Even if you can use python to parse json, it will still take a > > > quadratic operation to convert that parsed data structure > > > back to a J box array. Untested. > > > > > > Пн, 03 мар 2014, June Kim (김창준) писал(а): > > > > Hello, > > > > > > > > I recently tried to work on a JSON file (a bookmark file from Chrome > > > > browser), which is about 28MB. My initial attempt was using the json > > > parser > > > > from the J packages. Oh, it was slow. It took more than one minute on > > my > > > > machine. > > > > > > > > Disappointed, but I was kind of expecting the slow performance > because > > > > string and tree are not what J's strength is. > > > > > > > > Now I turned to Python and tried parsing the file using the standard > > > > package. Oh, I took about a second. > > > > > > > > So I can proceed with Python but I want to know if there are any > other > > > > options working with J with better performance. > > > > > > > > June > > > > > ---------------------------------------------------------------------- > > > > For information about J forums see > http://www.jsoftware.com/forums.htm > > > > > > -- > > > regards, > > > ==================================================== > > > GPG key 1024D/4434BAB3 2008-08-24 > > > gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 > > > gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm