Fork me on GitHub

I'm seeing Datascript's performance degrade by a factor of about 3-4 going from JVM to CLJS. I'm wondering whether running a local JVM server would be worth it performance-wise, considering the necessary overheads of doing so (e.g. transit). Any thoughts?


It doesnt matter if the CLJS version is not as performant as CLJ, if the CLJS version perfromant enough within the overall system (no need to optomise unless its really needed). If there is a performance issue that is effecting the system and its users, then its probably worth using the JVM (especially if the performance is likely to grow as an issue)


All good points, thanks. I'm designing the system, so I'm thinking through the possibilities.


Definately worth a spike to compare the relative performances if there is time. I often implement two or more approaches for more important design decisions.

gratitude 1

Yeah, it's a known issue. Are you using DataScript in the browser? Or this is for a server-side CLJS/JS setup?


That being said, DataScript apparently has gotten decent perf. improvements recently and anecdotally things do feel faster but I have no exact numbers, take it with a grain of salt (I am using DataScript in a React Native project, mainly iOS)


Pull is drastically faster, I've measured 🙂 I might have overestimated the degradation factor, it seems to me more about 2-3. I don't think its DataScript specific? JVM vs. browser.

👌 1
Romit Gandhi13:01:34

Hello, I'm new to Clojure. I wanted to know what is the best folder structure for clojure and clojure-script (re-frame) ?


For clojure, I would steer you to to see how it’s structured. Yes, this is a library, but there isn’t much difference. So:
     app_name/ ;; "implementation" details
From my experience, the best results come from: • A simple structure • Give each namespace a meaningful name and have it serve a purpose. e.g. don’t use names like core or index . They don’t tell us anything about the namespace. • Don’t worry about files getting “too big” — infact, load them up at first unless you have a very clear picture of what it’s supposed to be. • Your structure may evolve over time, this is fine. For reframe, they actually have an approach which they provide:


If you use a template for a certain type of project a lot of times it lays the ground work… e.g.

$ lein new re-frame your-app-name

Romit Gandhi17:01:16

Thank you @UH1MELU4U for sharing this, Actually I didn't like to put events and subs in single file. Do you make folders for events and subs and import all that files in the core.cljs ?

Romit Gandhi17:01:36

Thank you @U6GNVEWQG, do you have anything specific structure of proper web development project that will help me very much.


I don’t have one up right now for front to back. My front end projects look like this:

👍 1
Muhammad Hamza Chippa20:01:56

{"user_account" [{"user_account_id" 1, "user_type" 0}]} I have this type of data in the clojurescript file, I wanted to convert string into keyword how can I do that is not working in the clojurescript file ?


> is not working in the clojurescript file > Yes it's not supported but the data is not json anyway (edited misleading statement to avoid confusion) I assume it's a clojure map. Try As well as if you want more complex conversions


@UEQPKG7HQ Also, is Clojure-only -- you cannot use it in ClojureScript.

👍 1

Oh right, didn't think of that, thanks. In any case, both keywordize-keys and camel-case-kebab work in cljs!


(! 714)-> clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -M -m cljs.main -r
ClojureScript 1.11.4
cljs.user=> (require '[clojure.walk :as walk])
cljs.user=> (def data {"user_account" [{"user_account_id" 1, "user_type" 0}]})
cljs.user=> (walk/keywordize-keys data)
{:user_account [{:user_account_id 1, :user_type 0}]}


And it works the same in Clojure in this case:

(! 715)-> clj
Clojure 1.10.3
user=> (require '[clojure.walk :as walk])
user=> (def data {"user_account" [{"user_account_id" 1, "user_type" 0}]})
user=> (walk/keywordize-keys data)
{:user_account [{:user_account_id 1, :user_type 0}]}

🙌 1