[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: JSON->lisp Mapping: Hash vs AList
From: |
Clément Pit-Claudel |
Subject: |
Re: JSON->lisp Mapping: Hash vs AList |
Date: |
Mon, 18 Dec 2017 11:15:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 2017-12-17 12:44, Philipp Stephani wrote:
> > > + result = Fnreverse (result);
> >
> > Is there a reason for calling nreverse here?
> >
> > It puts the elements in the same order as the original JSON. (The
> Jansson parser also retains the original
> > order.)
> > This isn't very important, just a bit nicer and less surprising.
>
> It's a potential performance hit, but if you think it's worthwhile,
> it's fine with me.
>
> I don't care much. For now I'd leave it in, we can take it out later if it
> hurts performance too much. (Though people that care about performance should
> probably use hashtables anyway.)
Would it make it faster to construct the list in order, instead of constructing
it in reverse and then reversing it?
Something like the following, but in C:
;; the direct version
(defun map-fn-over-list (fn list)
(when list
(let* ((out (cons (funcall fn (pop list)) nil))
(lastcdr out))
(while list
(setcdr lastcdr (cons (funcall fn (pop list)) nil))
(setq lastcdr (cdr lastcdr)))
out)))
Clément.
- Re: JSON->lisp Mapping: Hash vs AList, (continued)
- Re: JSON->lisp Mapping: Hash vs AList, Eli Zaretskii, 2017/12/17
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/17
- Re: JSON->lisp Mapping: Hash vs AList, Eli Zaretskii, 2017/12/17
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/18
- Re: JSON->lisp Mapping: Hash vs AList, Eli Zaretskii, 2017/12/18
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/18
- Re: JSON->lisp Mapping: Hash vs AList, Vibhav Pant, 2017/12/18
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/19
- Re: JSON->lisp Mapping: Hash vs AList, Eli Zaretskii, 2017/12/19
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/19
- Re: JSON->lisp Mapping: Hash vs AList,
Clément Pit-Claudel <=
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/19
Re: JSON->lisp Mapping: Hash vs AList, Vibhav Pant, 2017/12/14
- Re: JSON->lisp Mapping: Hash vs AList, Philipp Stephani, 2017/12/16
- [PATCH] Accept alists when serializing JSON, Philipp Stephani, 2017/12/18
- Re: [PATCH] Accept alists when serializing JSON, Vibhav Pant, 2017/12/20
- Re: [PATCH] Accept alists when serializing JSON, Philipp Stephani, 2017/12/22
- Re: [PATCH] Accept alists when serializing JSON, Vibhav Pant, 2017/12/24
- Re: [PATCH] Accept alists when serializing JSON, Philipp Stephani, 2017/12/26
Re: [PATCH] Accept alists when serializing JSON, Philipp Stephani, 2017/12/24
Re: JSON->lisp Mapping: Hash vs AList, Stefan Monnier, 2017/12/16