Skip to content

Instantly share code, notes, and snippets.

View aam's full-sized avatar

Alexander Aprelev aam

  • Mountain View, CA
View GitHub Profile
@aam
aam / crunch.dart
Last active March 26, 2024 04:27
Running 8 isolates results in ~3x speedup on JIT
import 'dart:math';
import 'dart:io';
import 'dart:isolate';
CountHits(List args) {
print('${Isolate.current.debugName} $args');
final from = args[0] as int;
final to = args[1] as int;
final sendPort = args[2] as SendPort;
Before OSR:
==== tryosr.dart_::_main (RegularFunction)
B0[graph]:0 <-1:-1>
B1[function entry]:2 <-1:-1>
CheckStackOverflow:8(stack=0, loop=0)
DebugStepCheck:10()
DebugStepCheck:12()
StoreLocal(x @-8, t0)
t0 <- LoadLocal(:current_context_var @0)
```
main() {
var x = 123;
try {
try {
if (x < -1) {
print('x is negative? impossible');
}
while(true) {
x += 1;
@aam
aam / gist:cb0eed24c58d0c0f107be9a89b9e93f3
Last active March 11, 2021 03:12
mock up of file contents in CompilerOutput
diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart
index 49e224c802..ff79346b68 100644
--- a/packages/flutter_tools/lib/src/compile.dart
+++ b/packages/flutter_tools/lib/src/compile.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
+import 'dart:typed_data';
@aam
aam / flutter-win-ps.patch
Last active February 3, 2021 17:08
Suppress progress indication that could lead to strange font/color changes to Windows cmd shell session
diff --git a/bin/internal/update_dart_sdk.ps1 b/bin/internal/update_dart_sdk.ps1
index 0166dc8e83..f38bec2d95 100644
--- a/bin/internal/update_dart_sdk.ps1
+++ b/bin/internal/update_dart_sdk.ps1
@@ -56,6 +56,7 @@ $dartSdkZip = "$cachePath\$dartZipName"
Try {
Import-Module BitsTransfer
+ $ProgressPreference = 'SilentlyContinue'
Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip -ErrorAction Stop
// @dart = 2.9
import 'dart:io';
import 'dart:isolate';
import 'dart:async';
import 'package:path/path.dart' as p;
void main(List<String> arguments) async {
// var a = <int?>[];
@aam
aam / linux_type_computation.txt
Last active May 29, 2020 17:19
Type computation trace for core_int__parse
reaching type to v5 <- StaticCall:12( _lastNonWhitespace@0150898<0> v2, using unchecked entrypoint, result_type = T{int}) T{int} for v2 is T{_StringBase}
reaching type to v8 <- BinaryInt64Op(+ [tr], v5, v7) T{int} for v5 is T{int}
reaching type to v8 <- BinaryInt64Op(+ [tr], v5, v7) T{int} for v7 is T{_Smi}
reaching type to v11 <- EqualityCompare(v8 == v10) T{bool} for v8 is T{int}
reaching type to v11 <- EqualityCompare(v8 == v10) T{bool} for v10 is T{_Smi}
reaching type to AssertBoolean:18(v11) for v11 is T{bool}
reaching type to Branch if StrictCompare:20(===, v11, v13) goto (3, 4) for v11 is T{bool}
reaching type to Branch if StrictCompare:20(===, v11, v13) goto (3, 4) for v13 is T{bool}
reaching type to v14 <- StaticCall:36( _firstNonWhitespace@0150898<0> v2, using unchecked entrypoint, result_type = T{int}) T{int} for v2 is T{_StringBase}
reaching type to v16 <- InstanceCall:38( codeUnitAt<0>, v2, v14 IC[0: ], result_type = T{_Smi}) T{_Smi} for v2 is T{_StringBase}
*** BEGIN CFG
After AllocateRegisters
==== dart:core_int__parse@0150898
0: B0[graph]:0 {
v0 <- Constant(#null) T{Null?}
v1 <- Constant(#<optimized out>) T{_OneByteString}
v7 <- Constant(#1) [1, 1] T{_Smi}
v10 <- Constant(#0) [0, 0] T{_Smi}
v13 <- Constant(#true) T{bool}
v18 <- Constant(#43) [43, 43] T{_Smi}
diff --git a/clang-format-diff.py b/clang-format-diff.py
index ffa30e7..9c5bcc5 100755
--- a/clang-format-diff.py
+++ b/clang-format-diff.py
@@ -27,7 +27,7 @@ import difflib
import re
import string
import subprocess
-import StringIO
+import io
@aam
aam / update-engine-in-fuchsia.sh
Created November 5, 2019 19:01
update prebuilt flutter engine artifacts in fuchsia with locally-built ones
FUCHSIA_ROOT=~/p/fuchsia
cd $FH/engine/src
cd flutter
ENGINE_REV=`git log -1 | head -1 | awk '{print $2}'`
cd -
echo at $ENGINE_REV