Skip to content

Instantly share code, notes, and snippets.

diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 4998a7343..31e4e9220 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -904,6 +904,7 @@ config("optimize") {
}
ldflags = common_optimize_on_ldflags + lto_flags
cflags += lto_flags
+ # cflags += ["-mllvm", "-enable-ml-inliner=release"]
}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 4998a7343..29a07cbfe 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -904,6 +904,7 @@ config("optimize") {
}
ldflags = common_optimize_on_ldflags + lto_flags
cflags += lto_flags
+ cflags += ["-Xclang", "-fembed-bitcode=all"]
}
@liyuqian
liyuqian / main.dart
Created November 4, 2020 00:36
Demo Flutter app to show how one can blow up memory by having many picture raster caches.
import 'package:flutter/material.dart';
void main() {
runApp(CacheMemTestApp());
}
class CacheMemTestApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return CacheMemTestAppState();
@liyuqian
liyuqian / main.dart
Created October 29, 2020 03:04
Simulate the expected number of days to have all devices failed randomly.
import 'dart:math';
void main() {
const int deviceCount = 5;
const double failRate = 0.5;
const int sampleCount = 1000;
final random = Random();
int sum = 0;
for (int i = 0; i < sampleCount; i += 1) {
@liyuqian
liyuqian / print.r
Created September 24, 2020 00:16
Demo CLT (see how means get more concentrated, and their standard deviation shrinks to ~1/3 when n increases from 10 to 90)
# Number of samples to compute the mean. We try different n from 10, 20, ..., 90
n = seq(10, 90, 10)
# Number of means to compute the standard deviation of the mean
m = 30
set.seed(159)
# Generate a single random value from a "strange" distribution
gen.value <- function()
sample(1:10, 1) + # Offset
@liyuqian
liyuqian / diff
Created September 16, 2020 21:12
raster cache memory service protocol test
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 9008f0389b..a4fb521e6e 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -961,6 +961,13 @@ abstract class ResidentRunner {
final List<FlutterView> views = await flutterDevices
.first
.vmService.getFlutterViews();
+
+ final Map<String, Object> memoryData = await flutterDevices.first.vmService.estimateRasterCacheMemory(
@liyuqian
liyuqian / main.dart
Created September 9, 2020 00:16
animateTo test
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
@liyuqian
liyuqian / main.dart
Last active July 15, 2020 17:10
Demo how ScrollablePositionedList can handle big jump much faster than the default ListView
// Demo how ScrollablePositionedList can handle big jump much faster than its ListView counterpart at
// https://gist.github.com/esDotDev/792425c2cdfef947ce514b8ab70511e6
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
class ScrollbarSpike extends StatefulWidget {
@override
_ScrollbarSpikeState createState() => _ScrollbarSpikeState();
@liyuqian
liyuqian / contributions.md
Last active July 9, 2020 00:16
some public contributions

Some public contributions to Flutter:

Framework

  • Added a filterQuality parameter to texture #59966 (zljj0818) [06/2020]
  • fix memory leak of android view #50111 (Stonekity) [05/2020]
  • Add error message for flutter_gallery transitions_perf test. #47776 (linxuebin1990) [02/2020]
  • support endless recorder for timeline #47419 [02/2020]

Engine

  • Allow texture sampling quality control #18814 (zljj0818) [06/2020]
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override