docs(aio): Clearing array with [] (#20369) (#20395)

Clearing array with setting length to 0 replaced with [] for being short
and marginally efficient. For reference: [] is turned into a sequence of
around 15 machine instructions on x64 (if bump pointer allocation succeeds),
whereas a.length=0 is a C++ runtime function call, which requires 10-100x as
many instructions.
Benedikt Meurer

PR Close #20395
This commit is contained in:
Shavi Pathania
2017-11-13 21:13:37 +05:30
committed by Miško Hevery
parent 717ac5ac4d
commit 0fedb57cb0
11 changed files with 11 additions and 11 deletions

View File

@ -9,6 +9,6 @@ export class MessageService {
}
clear() {
this.messages.length = 0;
this.messages = [];
}
}