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

Slow view import after upgrade to version 5 #1772

Open
kvandenhaute opened this issue Feb 16, 2022 · 0 comments
Open

Slow view import after upgrade to version 5 #1772

kvandenhaute opened this issue Feb 16, 2022 · 0 comments
Labels
type:unverified bug A bug report that has not been verified

Comments

@kvandenhaute
Copy link

kvandenhaute commented Feb 16, 2022

Marko Version: 5.19.0

Details

We have a custom build process where we compile Marko views and render them on request with specific input data. After doing the upgrade to version 5.19.0 (coming from 4.24.2) we noticed that the importing of the compiled Marko views took at least 4-5 times the normal time.

Expected Behavior

The time to import the compiled Marko view should be around the same time (or faster) in version 5.

Actual Behavior

The time to import the compiled Marko view is at least 4-5 times slower in version 5.

Your Environment

  • node 14.17.0
  • macOS Big Sur 11.3.1

Steps to Reproduce

Implementation @ 4.24.2

import Marko from 'marko/src/compiler';

const contents = Marko.compileFile('pathToMarkoFile');
import { performance } from 'perf_hooks';

const startTime = performance.now();
const compiledView = await import('pathToCompiledMarkoFile').then(result => result.default);
const endTime = performance.now();

console.log(`${(endTime - startTime).toFixed(2)}ms`);

const html = compiledView.renderToString({ key: 'value' });

Implementation @ 5.19.0

import { compileFileSync } from '@marko/compiler';
import fs from 'fs';

const contents = compileFileSync('pathToMarkoFile', {
    modules: 'cjs',
    fileSystem: fs
}).code;
import { performance } from 'perf_hooks';

const startTime = performance.now();
const compiledView = await import('pathToCompiledMarkoFile').then(result => result.default);
const endTime = performance.now();

console.log(`${(endTime - startTime).toFixed(2)}ms`);

const html = compiledView.renderToString({ key: 'value' });
@kvandenhaute kvandenhaute added the type:unverified bug A bug report that has not been verified label Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:unverified bug A bug report that has not been verified
Projects
None yet
Development

No branches or pull requests

1 participant