mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:27:39 +00:00
6ca7571e2b
AOT: SwitchFSM.enum(RunTime): 29.549523327947906 us. SwitchFSM.int(RunTime): 37.73789702628717 us. SwitchFSM.class(RunTime): 138.6418530572675 us. SwitchFSM.string(RunTime): 797.54075 us. dart2js+V8: SwitchFSM.enum(RunTime): 31.484299349840917 us. SwitchFSM.int(RunTime): 26.022895908416366 us. SwitchFSM.class(RunTime): 91.67433302667894 us. SwitchFSM.string(RunTime): 92.31338451577098 us. Both AOT and dart2js are 'good at' switches on enum values. When compiled with --enable-experiment=records,patterns: AOT: SwitchFSM.enum(RunTime): 141.75470079359405 us. SwitchFSM.int(RunTime): 145.25322604030737 us. SwitchFSM.class(RunTime): 138.45460840662005 us. SwitchFSM.string(RunTime): 797.226 us. dart2js+V8: SwitchFSM.enum(RunTime): 98.93787283573403 us. SwitchFSM.int(RunTime): 29.459852700736498 us. SwitchFSM.class(RunTime): 98.62184338405162 us. SwitchFSM.string(RunTime): 92.035889371936 us. There is work to be done to recover the performance. Change-Id: I1197129cb32615a06a63a05d7ba300b46c68b4d2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287246 Reviewed-by: Alexander Markov <alexmarkov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Stephen Adams <sra@google.com>
67 lines
777 B
Dart
67 lines
777 B
Dart
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
enum State {
|
|
start,
|
|
a1,
|
|
a2,
|
|
a3,
|
|
a4,
|
|
a5,
|
|
a6,
|
|
a7,
|
|
|
|
error,
|
|
|
|
extended1,
|
|
extended2,
|
|
extended3,
|
|
extended4,
|
|
|
|
two3,
|
|
two4,
|
|
two5,
|
|
two6,
|
|
two7,
|
|
|
|
three4,
|
|
three5,
|
|
three6,
|
|
three7,
|
|
|
|
four5,
|
|
four6,
|
|
four7,
|
|
|
|
// First additional byte of 3.
|
|
first0,
|
|
first1,
|
|
first2,
|
|
first3,
|
|
first4,
|
|
first5,
|
|
first6,
|
|
first7,
|
|
|
|
// Second last additional byte.
|
|
prev0,
|
|
prev1,
|
|
prev2,
|
|
prev3,
|
|
prev4,
|
|
prev5,
|
|
prev6,
|
|
prev7,
|
|
|
|
// Last additional byte.
|
|
last0,
|
|
last1,
|
|
last2,
|
|
last3,
|
|
last4,
|
|
last5,
|
|
last6,
|
|
last7,
|
|
}
|