add v8 analysis transormations

This commit is contained in:
mdgriffith 2021-01-22 19:54:30 -05:00
parent 54eb331b2e
commit 98028ed16c
3 changed files with 23 additions and 15 deletions

View File

@ -19,14 +19,16 @@ const defaultOptions: Transforms = {
replaceVDomNode: false,
variantShapes: true,
inlineNumberToString: false,
inlineEquality: false,
inlineFunctions: false,
inlineEquality: true,
inlineFunctions: true,
listLiterals: false,
passUnwrappedFunctions: false,
passUnwrappedFunctions: true,
arrowFns: false,
shorthandObjectLiterals: false,
objectUpdate: ObjectUpdate.InlineSpread,
objectUpdate: false,
unusedValues: false,
replaceListFunctions: true,
v8Analysis: false
};
const options = {
@ -67,11 +69,11 @@ async function go() {
// dir: 'testcases/elm-css',
// elmFile: 'Main.elm',
// },
// {
// name: 'Html',
// dir: 'testcases/html',
// elmFile: 'Main.elm',
// },
{
name: 'Html',
dir: 'testcases/html',
elmFile: 'Main.elm',
},
// {
// name: 'Elm UI',
// dir: 'testcases/elm-ui',
@ -93,11 +95,11 @@ async function go() {
// elmFile: 'Run.elm',
// },
// // // This one takes forever
{
name: 'elm-obj-file',
dir: 'testcases/elm-obj-file',
elmFile: 'Run.elm',
},
// {
// name: 'elm-obj-file',
// dir: 'testcases/elm-obj-file',
// elmFile: 'Run.elm',
// },
]);
const result = await report;

View File

@ -23,6 +23,7 @@ import { createPassUnwrappedFunctionsTransformer } from './transforms/passUnwrap
import { replaceVDomNode } from './transforms/adjustVirtualDom';
import { inlineNumberToString } from './transforms/inlineNumberToString';
import { replaceListFunctions } from './transforms/replaceListFunctions';
import { reportFunctionStatusInBenchmarks, v8Debug } from './transforms/analyze';
export type Options = {
compile: boolean;
@ -78,6 +79,9 @@ export const transform = async (
let inlineCtx: InlineContext | undefined;
const transformations: any[] = removeDisabled([
[transforms.replaceListFunctions, replaceListFunctions],
[transforms.v8Analysis, v8Debug],
[transforms.variantShapes, normalizeVariantShapes],
[transforms.inlineFunctions, createFunctionInlineTransformer(verbose)],
[transforms.inlineEquality, inlineEquality()],
@ -103,7 +107,7 @@ export const transform = async (
[transforms.arrowFns, convertFunctionExpressionsToArrowFuncs],
[transforms.shorthandObjectLiterals, convertToObjectShorthandLiterals],
[transforms.unusedValues, createRemoveUnusedLocalsTransform()],
[transforms.replaceListFunctions, replaceListFunctions],
[transforms.v8Analysis, reportFunctionStatusInBenchmarks],
]);
const {

View File

@ -35,6 +35,7 @@ export type Transforms = {
objectUpdate: ObjectUpdate | false;
unusedValues: boolean;
replaceListFunctions: boolean;
v8Analysis: boolean;
};
export enum InlineLists {
@ -76,4 +77,5 @@ export const toolDefaults: Transforms = {
objectUpdate: false,
unusedValues: false,
replaceListFunctions: false,
v8Analysis: false
};