Skip to content
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

Include all goog.object functions #247

Closed
dehli opened this issue Aug 23, 2022 · 4 comments
Closed

Include all goog.object functions #247

dehli opened this issue Aug 23, 2022 · 4 comments

Comments

@dehli
Copy link
Contributor

dehli commented Aug 23, 2022

Is your feature request related to a problem? Please describe.
I'd like to use certain goog.object functions via nbb that aren't available (such as getAllPropertyNames).

Describe the solution you'd like
I'd like to have access to all goog.object functions from within nbb.

Describe alternatives you've considered
I could rewrite the code that uses the non-included goog.object functions.

Additional context
I unfortunately didn't read the dev.md until after coming up with a solution so I have a potential PR here: #248

@borkdude
Copy link
Collaborator

@dehli Can you check, when running bb release with main + bb release with this PR what the total size difference is?

We may want to make goog.object lazy if this has an impact on startup time. I'll run some tests myself too.

@dehli
Copy link
Contributor Author

dehli commented Aug 23, 2022

When running bb release with the two branches I'm getting very similar sizes. This is the size difference of :nbb_core (gzipped).

#247 main
:nbb_core 215.51 KB 214.07 KB
goog.object 3.48 KB 703 B

247-report.html
main-report.html

When drilling down into the google-closure-library, I can see that goog/object/object.js contributes 3.48 KB on my branch, whereas it contributes 703 bytes on main (this report is very cool btw).

image

I'll do some investigation on startup time as well / lazy loading.

@dehli
Copy link
Contributor Author

dehli commented Aug 23, 2022

Startup time seems to be unaffected from my testing. I used the following babashka task to compare the two start-up times:

(let [num   1000
      nbb   (fn [] (shell "./cli.js -e nil"))
      start (java.time.LocalDateTime/now)
      _     (dorun (take num (repeatedly nbb)))
      end   (java.time.LocalDateTime/now)
      diff  (java.time.Duration/between start end)]

  (println (/ (.toMillis diff) (float num)))
#247 main
157.261ms 158.860ms

@borkdude
Copy link
Collaborator

OK, this is an insignificant different and I'm ok with adding everything from goog.object in a non-lazy fashion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants