自v2.1.16以来,r.js依赖关系跟踪是否明显变慢?还是只是我? [英] Is r.js dependency tracing significantly slower since v2.1.16? Or is it just me?

查看:72
本文介绍了自v2.1.16以来,r.js依赖关系跟踪是否明显变慢?还是只是我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到与2.1.15和之前的版本相比,r.js 2.1.16/2.1.17版的构建时间显着增加.多余的时间似乎是在为...跟踪依赖项"过程中花费的.

I have noticed a dramatic increase in build time in r.js versions 2.1.16/2.1.17, as compared to 2.1.15 and before. The extra time seems to be spend during the 'Tracing dependencies for...' fase.

我的build.js看起来像这样:

({
    baseUrl: 'some/path/here',
    mainConfigFile: 'some/path/here',
    dir: 'some/path/here',
    modules: [
        {
            name: "base"
        },
        {
            name: "specific",
            exclude: ["base"]
        }
    ],
    findNestedDependencies: true,
    removeCombined: true,
    skipDirOptimize: true,
    optimize: "none"
})

在Windows环境中使用node.js运行此构建. basespecific都具有相当数量(但不是荒谬的)的嵌套依赖项(basespecific中内部引用,因此被排除在外).在2.1.15中,此版本在我的系统上将花费±2秒;在2.1.16/2.1.17中需要±8秒. (请注意,所有丑陋功能均已禁用,因此这不是一个因素)

In run this build using node.js in a Windows environment. Both base and specific have a decent (but not absurd) amount of nested dependencies (base is referenced internally in specific, and is therefore excluded). In 2.1.15 this build would take ±2 seconds on my system; in 2.1.16/2.1.17 it takes ±8 seconds. (note that all uglification has been disabled, so this is not a factor)

我包括了该build.js供参考,但我认为实际上不是我的设置会导致速度下降.我已经尝试了许多(简单的)场景,但它们在跟踪对2.1.16/2.1.17的依赖时似乎都慢得多.

I include this build.js for reference, but I don't think it is actually my settings that cause the slowdown. I have tried many (simple) scenarios and they all seem to be a lot slower at tracing dependencies on 2.1.16/2.1.17.

有人也发生这种情况吗?还是只是我?我很确定,随着我的项目的发展,构建时间的 4x 增长会开始成倍地困扰我,所以请提出建议:-)

Anyone have this happening too? Or is it just me? I'm pretty sure that while my project grows, this 4x increase in build time will start to annoy me exponentially, so please advice :-)

推荐答案

我在使用findNestedDependencies: true的Linux上也遇到了同样的问题. 此问题在此处报告 https://github.com/jrburke/r.js/issues/850

I have the same issue on Linux with findNestedDependencies: true. The issue is reported here https://github.com/jrburke/r.js/issues/850

此处提到了以下发行信息 http://requirejs.org/docs/download.html .这是造成此问题的最可能原因.

The following release info is mentioned here http://requirejs.org/docs/download.html. This is the most likely reason for the issue.

2.1.16

2.1.16

值得注意的变化是在r.js优化器中:

The notable changes are in the r.js optimizer:

Esprima 2.0在分析模块的依赖性时由优化器使用.这允许使用某些ES6功能.支持Esprima 2.0解析的内容(在xpcshell中运行时,仍使用Reflect.parse).

Esprima 2.0 is used by the optimizer when parsing modules for dependencies. This allows some ES6 features to be used. Whatever is parsable by Esprima 2.0 is what is supported (when running in xpcshell, Reflect.parse is still used).

这篇关于自v2.1.16以来,r.js依赖关系跟踪是否明显变慢?还是只是我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆