This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-07
Channels
- # adventofcode (94)
- # babashka (29)
- # babashka-sci-dev (2)
- # beginners (103)
- # calva (15)
- # cider (17)
- # clj-kondo (62)
- # cljsrn (24)
- # clojars (13)
- # clojure (97)
- # clojure-belgium (3)
- # clojure-berlin (3)
- # clojure-czech (1)
- # clojure-europe (68)
- # clojure-nl (1)
- # clojure-norway (3)
- # clojure-seattle (3)
- # clojure-uk (1)
- # clojurescript (7)
- # community-development (29)
- # conjure (2)
- # cursive (14)
- # data-science (15)
- # emacs (3)
- # graphql (10)
- # gratitude (1)
- # holy-lambda (32)
- # hoplon (21)
- # hyperfiddle (2)
- # jobs (2)
- # joyride (36)
- # lsp (4)
- # meander (13)
- # off-topic (203)
- # pathom (3)
- # polylith (6)
- # re-frame (4)
- # reagent (1)
- # reitit (28)
- # releases (1)
- # shadow-cljs (16)
- # slack-help (2)
- # sql (27)
- # vim (2)
I use Krell, React-Native. Require of a local file only works when specified in the project main namespace. Is it possible to require a local file in any project namespace?
Hi! If you want to use a namespace other than the project namespace, put the require there and then include the project name space as a require in the main namespace, for example:
foo.cljs:
(ns foo
(:require ["bar" :as bar]))
main.js:
(ns main
(:require ...
[foo]))
The require in the main namespace will ensure that all dependencies can be found.Thanks for the info, but I meant using require of a local file, for example image (def icon (js/require "../../assets/icons/icon.png"))
To be clear: your requires, either through the ns
declaration or using js/require
must be accessible transitively from your main function.
Hello. We came up on a problem at my company recently in which a server (Clojure) endpoint returns a large-ish response as transit-json, and it was about a 5+ second roundtrip from our cljsrn app to when we got and parsed the response. We realized most of the time was spent on the client, so we switched to using edn instead of transit-json and the roundtrip + parsing was reduced to ~600ms. I was under the impression that transit is supposed to be faster than edn for this. Is that true even with a react native app?
I think the engines are only the same if the browser is Safari, but I could be wrong. I believe our app is using JavaScriptCore (which Safari uses). Chrome uses V8. Firefox uses SpiderMonkey. > Have you tried it on the mobile browser to see what happens there? What mobile browser are you referring to?
On iOS, all browsers use Webkit (and therefore JSC), I think. RN uses JSC unless you are using the new Hermes engine.
But I’m just asking in order to narrow down the issue; if you see the same thing happen on mobile browsers, it’s not RN that’s the issue.
And then if you see the same issue on desktop Chrome/Firefox, it’s something about your EDN/Transit that is different for some reason.
Ok so Diego did more testing and we found that even in a chromium-based browser (Brave), so maybe V8 engine, the transit response payloads were significantly larger than the edn response payloads, and the response time was also significantly higher with transit (which of course makes sense given the larger payload size). Below is transit on top and edn on bottom.
Interesting. So I guess this is more of a general Transit-vs-EDN performance detail.
So it must be something about our data that makes it more efficient to send as EDN than as transit
I wonder if the number of edn-specific values types has an effect on payload size. That would make sense to me.
Yup. There might be a transit-specific channel it’d be worth checking on to see if there’s an easy optimization you could do?