Closed khmelevskii closed 11 months ago
@khmelevskii Hi Yurii.
Before making any changes as an attempted solution, it'd be good to verify (and ideally try quantify) the problem.
What makes you believe that unnecessary code is being loaded on the client? This occurs with production (:advanced
) builds? Any idea how much unnecessary code is being loaded?
Thanks
@ptaoussanis I've just built client and can see the following statistic:
taoensso/sente.cljc | 42.93 KB
taoensso/sente/interfaces.cljc | 474
taoensso/encore.cljc | 27.02 KB
taoensso/timbre.cljc | 7.81 KB
taoensso/timbre/appenders/core.cljc | 1.93 KB
taoensso/truss/impl.cljs | 1.36 KB
~ 81KB
This is after optimization. I think it's pretty big for client.
So, it would be awesome split server and client to separate files. I think it can reduce size a lot. Also it would be ideal to remove unnecessary dependencies on client like timbre
.
@khmelevskii Hi Yurii,
Thanks for the info. Note though that the key question isn't how big the Sente client is, but how much smaller it could be by splitting to client/server namespaces.
To clarify: I'm not at all opposed to splitting - might be a nice change anyway. Just pointing out that if your motivation is a significant reduction in size, it's not immediately obvious to me how big of a difference this would make.
Would be happy to see a PR if you wanted to give this a try, but I'd recommend starting with a quick+dirty experiment to first quantify the difference. Depending on the results, it might/not be worth your time/effort (your call!).
Suggested namespace structure if you do want to a submit a PR:
taoensso.sente.client
; Client-only codetaoensso.sente.server
; Server-only codetaoensso.sente.common
; Anything common between client & servertaoensso.sente
; Backwards-compatible aliases to prevent breaking old users (I can handle this)Cheers :-)
Edit to add:
Also it would be ideal to remove unnecessary dependencies on client like timbre.
Ideas welcome if you have a suggestion for how to remove Timbre while still allowing opt-in for the same capabilities incl. namespace filtering, compile-time elision (handy for production clients), rate limiting, and support for Timbre appenders.
Please note that this'd need to be a separate PR - and that I'm skeptical that saving 7k (substantially less once compressed) would be worth anything but a trivial effort.
Closing for inactivity as part of issue triage.
It would be great to split
sente.cljc
toserver.cljc
andclient.cljc
. It will help not load unnecessary code on client. I can prepare PR if you think it can be implemented in sente