Dart Import Library size

34 views
Skip to first unread message

Shlomo Belleli

unread,
May 24, 2023, 9:53:01 AM5/24/23
to Dart Misc
Hi
If I am using the show / hide with Import and by that loading a part of a library is it will improve performance or is related only to namespacing and collision between other libraries?

Shlomo


Bob Nystrom

unread,
May 24, 2023, 1:22:09 PM5/24/23
to mi...@dartlang.org
It shouldn't have any measurable impact on performance. The compiler already knows exactly which top-level declarations you are referring to from which libraries, regardless of show/hide clauses.

Cheers!

– bob

--
For more ways to connect visit https://dart.dev/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/6b95d24e-07e0-444b-a28a-c2b8138a33c5n%40dartlang.org.

Shlomo Belleli

unread,
May 24, 2023, 1:48:28 PM5/24/23
to Dart Misc, Bob Nystrom
But if the library files will be smaller as  library per subject/objects and not a case of fewer files but each one bigger
is this can impact performance?

Let's take an example one bug library to define all  database entities,  such as  columns, tables, and such
or library per table/domain, and one more small common library to represent all common issues between all the rest
Do I need to use loadLibrary (defer loading), is there a way to control the main.js that the Dart compiler is building?
Is the loader aware of when to load each library?

-Shlomo

Bob Nystrom

unread,
May 25, 2023, 6:52:12 PM5/25/23
to Shlomo Belleli, Dart Misc
On Wed, May 24, 2023 at 10:48 AM Shlomo Belleli <shlomo....@gmail.com> wrote:
But if the library files will be smaller as  library per subject/objects and not a case of fewer files but each one bigger
is this can impact performance?

Let's take an example one bug library to define all  database entities,  such as  columns, tables, and such
or library per table/domain, and one more small common library to represent all common issues between all the rest
Do I need to use loadLibrary (defer loading), is there a way to control the main.js that the Dart compiler is building?
Is the loader aware of when to load each library?

Sorry, but I'm not that familiar with how deferred loading works and how the compiler decides how to organize things. But, in general, I would be very surprised if show/hide had any impact on it. The compiler knows precisely which declarations are actually referred to, so show/hide doesn't tell it anything it doesn't already know.

– bob
Reply all
Reply to author
Forward
0 new messages