Dart VM GC performance for functions with named parameters

42 views
Skip to first unread message

Bibaswan Bhawal

unread,
Apr 12, 2023, 9:42:00 AM4/12/23
to Dart Misc
When calling a function with named parameters does Dart create a new map which needs to be GCd after? This could be a potential performance problem and it might be better use positional  parameters versus named parameters

Martin Kustermann

unread,
Apr 12, 2023, 9:54:14 AM4/12/23
to mi...@dartlang.org
> When calling a function with named parameters does Dart create a new map which needs to be GCd after? This

No it doesn't. The caller will pass a hidden argument to the callee that describes the number of positional arguments and the names of named arguments it passes (this information is constant per-call site and is therefore a simple load instruction). The callee will then use this information to detect whether a value was passed or the default value should be used.

On Wed, Apr 12, 2023 at 3:42 PM Bibaswan Bhawal <bibasw...@gmail.com> wrote:
When calling a function with named parameters does Dart create a new map which needs to be GCd after? This could be a potential performance problem and it might be better use positional  parameters versus named parameters

--
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/062a17bf-16f5-4099-b033-d013e5588aa3n%40dartlang.org.
Reply all
Reply to author
Forward
0 new messages