-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce file size for Scala.js #69
Comments
Thanks for this information. Reducing the size is a goal for me too, for example, the tzdb format is very developer unfriendly but at the same time produces the smallest amount of code. At the same time the ways to make scala.js smaller is not 100% clear to me and I often have to resort to trial and error Regardless, here are some notes:
Have you checked on your js how many |
Oh, my 1st observation was accidentally conducted on
So savings is
No, I had not. Actually, I am not sure how to identify locales in Scala.js files... I can see 23 "localed.cldrl.data.~~~" string literals in JS files like the below, both in
I will check again if you suggest how to identify Just for reference, I use val formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")
val strRepl = odt.format(formatter)
val odt = OffsetDateTime.parse(strDate, DateTimeFormatter.ISO_OFFSET_DATE_TIME) |
Thanks. I'll add some of your questions to the documentation. The presence of those classes on
are you setting up your own locale? otherwise you'd be using |
No, I am not.
I see why there are strings like |
I ran some tests and it's correct that there is some extra locale data left even in fullOptJS i'll try to reduce both problems in the upcoming weeks now that M13 is ready |
FYI. When I opend this issue, I used Recently I changed to This is just a use-site tips. |
That is a great insight, perhaps it could be added to the documentation? |
|
I am looking forward a way to get the benefits of
java.time
API and reduce the Scala.js-generated file size at same time. I have started evaluating sbt-tzdb v0.1 for that purpose.I could save averagely 560KB in size (
fullOptJS
, no gzipped) in my several projects, by removing timezone DB withzonesFilter := { (z:String) => false}
. That is 25%~40% savings for my projects.(Note: I suppose my projects require no timezone DB, since my code base uses only
OffsetDateTime
,LocalDate
andDuration
right now)I also investigated why some project can save 40%, but other can save only 25%. My observation shows that my projects can save additional 747KB averagely, if
DateTimeFormatter
usage is eliminated completely. I suppose that there are huge amounts of locales forDateTimeFormatter
as similar as timezone DB.So... it would be great if one can filter locales for
DateTimeFormatter
in common with timezone DB. (Sorry in advance, in case of my assumption regardingDateTimeFormatter
is incorrect)The below is my observation of file size reduction in my projects.
Total
=Rest of code
+TimeZoneDB
+DateTimeFormatter
The below chart illustrates the above table
The text was updated successfully, but these errors were encountered: