Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Absorb breakage in benchmark-env instead of benchmark #1220

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions benchmark/benchmarks/krausest/lib/components/Application.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { templateFactory } from '@glimmer/opcode-compiler';
import { setComponentTemplate } from '@glimmer/manager';
import ApplicationTemplate from './Application.hbs';

export default class Application {
constructor(args) {
this.args = args;
Expand All @@ -21,6 +17,4 @@ export default class Application {
}
}

setComponentTemplate(templateFactory(ApplicationTemplate), Application);

/** @typedef {import('../utils/data').Item} Item */
6 changes: 0 additions & 6 deletions benchmark/benchmarks/krausest/lib/components/Row.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { templateFactory } from '@glimmer/opcode-compiler';
import { setComponentTemplate } from '@glimmer/manager';
import RowTemplate from './Row.hbs';

export default class Row {
constructor(args) {
this.args = args;
Expand All @@ -12,5 +8,3 @@ export default class Row {
};
}
}

setComponentTemplate(templateFactory(RowTemplate), Row);
12 changes: 9 additions & 3 deletions packages/@glimmer/benchmark-env/src/create-benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TemplateOnlyComponentManager } from '@glimmer/runtime';
import { getComponentTemplate } from '@glimmer/manager';
import { getComponentTemplate, setComponentTemplate } from '@glimmer/manager';
import { Benchmark } from './interfaces';
import createRegistry from './benchmark/create-registry';
import onModifier from './benchmark/on-modifier';
import ifHelper from './benchmark/if-helper';
import basicComponentManager from './benchmark/basic-component-manager';
import { templateFactory } from '@glimmer/opcode-compiler';

class TemplateOnlyComponentManagerWithGetComponentTemplate extends TemplateOnlyComponentManager {
getStaticLayout(definition: object) {
Expand All @@ -19,10 +20,15 @@ export default function createBenchmark(): Benchmark {
registry.registerModifier('on', null, onModifier);
registry.registerHelper('if', ifHelper);
return {
templateOnlyComponent: (name) => {
templateOnlyComponent: (name, template) => {
let definition = {};
setComponentTemplate(templateFactory(template), definition);

registry.registerComponent(name, null, TEMPLATE_ONLY_COMPONENT_MANAGER);
},
basicComponent: (name, _template, component) => {
basicComponent: (name, template, component) => {
setComponentTemplate(templateFactory(template), component);

registry.registerComponent(name, component, basicComponentManager);
},
render: registry.render,
Expand Down
6 changes: 3 additions & 3 deletions packages/@glimmer/benchmark-env/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dict, Template } from '@glimmer/interfaces';
import { Dict, SerializedTemplateWithLazyBlock } from '@glimmer/interfaces';
import { SimpleElement } from '@simple-dom/interface';

/**
Expand All @@ -17,7 +17,7 @@ export interface Benchmark {
* @param name
* @param template
*/
templateOnlyComponent(name: string): void;
templateOnlyComponent(name: string, template: SerializedTemplateWithLazyBlock): void;

/**
* Register a basic component
Expand All @@ -27,7 +27,7 @@ export interface Benchmark {
*/
basicComponent<TComponent extends object = object>(
name: string,
_template: Template,
template: SerializedTemplateWithLazyBlock,
component: new (args: ComponentArgs) => TComponent
): void;

Expand Down