Luminus goog.date.DateTime deserialization / performance considerations

basically luminus makes use of cljs-time ( parse ) for transit support. now doing so is clearly a performance problem and i have also found now the following related issue on github:

in the issue they are mentioning:

(goog.date/fromIsoString  iso-string)

which is already much better, but i feel like it should be easy enough to do even better than that, since one should be able to exploit the fact that one is in complete control over / has complete knowledge of the string-format one has to parse… having said that… at the moment i do not know if i am missing something here… and / or how one could try go about doing that… and / or if it would even be worth it…

any pointers / suggestions?

p.s. yesterday i already wrote about this… i also made a suggestion ( clearly wrong )… and so i noticed it after rereading… and deleted that post… so here is my altered suggestion…

(defn specific-iso-string-to-date-obj [iso-string]
  (let [yyyy (js/parseInt (subs iso-string 0 4))
        MM (dec (js/parseInt (subs iso-string 5 7)))
        dd (js/parseInt (subs iso-string 8 10))
        HH (js/parseInt (subs iso-string 11 13))
        mm (js/parseInt (subs iso-string 14 16))
        ss (js/parseInt (subs iso-string 17 19))
        sss (js/parseInt (subs iso-string 20 23))]
    (new goog.date.DateTime
         yyyy
         MM
         dd
         HH
         mm
         ss
         sss)))

probably wrong again :smile: … but… maybe this could be a starting point?

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.