-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[internals] Inline helpers + tweaks #4923
Conversation
Can I ask why these changes are necessary? What benefits do they bring? |
Hiya! I don't know, is there a disagreement or a misunderstanding ? |
The disagreement appears to be ( obviously ) about the tradeoff between extra bytes & runtime performance My bet is that nobody really knows since the source code actually has strong yet irresolute opinions about this very subject, it really is swinging real hard one way and the other at times |
Hmm.. i believe this PR (the beginning of the helper functions) is something worth look at before you start working on this. The helpers weren't added because of readability, it was for better minifiable. |
I do understand why you get this from the source code. Inline code gets bigger and bigger with time, and the general directions is to move them into helpers, to make the compiler code simpler as well as the output more minifiable, for example: #1256 moved keyed each diffing into a shared helper. So I am going to close this PR since it is mainly about inlining helpers. It is moving towards an opposite direction to what we are heading. (moving |
$$restProps
&$$slots
get_slot_changes
$$scope
declaration variable in dev moderender_listeners
other helpers inlined at compile time
for ( ... ) if ( each_value ) each_value.d( detaching )
Array.from((document.head || document.body ).querySelectorAll( id ))
if ( component.$$.fragment ) component.$$.fragment
.c()
/.l()
$$self.$$.on_destroy.push(subscribe(store, callback))
null != value ? value : ""
"function" === typeof value
value && "object" === typeof value && "function" === typeof value.then
{ ...a, ...b }
Object.create( null )
typeof props === "object" && props !== null ? props : {}
for( ... ) each_value();
subscribe(store, (v) => foo = v)()
src/runtime
update
functiondev.ts
dom.ts
andspread.ts
once
modifier fromutils.ts
todom.ts
.forEach
into for loopsThose changes naturally require updating expected test results. I intentionally did not commit those so as to give maintainers an opportunity to test the #4914 script, but all test are passing.