Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#14724 closed defect (fixed)

require() creates synthetic MIDs when passed a zero length array

Reported by: Kitson Kelly Owned by: Rawld Gill
Priority: undecided Milestone: 1.7.2
Component: Loader Version: 1.7.1
Keywords: Cc:
Blocked By: Blocking:

Description

When require is passed a zero length array, it goes ahead and creates a synthetic MID for controlling the loading of the additional modules, although it doesn't need to do anything.

For example the following will create a synthetic MID that does nothing:

require([], function(){
  console.log("hello!");
});

It was discovered while I was working on #14591 and the parser performance tests where when there were no MIDs being passed to require, it was still creating thousands and thousands of synthetic MIDs.

The attached patch checks for zero arrays, but there maybe a better way to "re-use" the sythentic MID for control on multiple invocations of require(), irrespective of it being empty or not.

Attachments (1)

dojo_require-zero-array.patch (287 bytes) - added by Kitson Kelly 8 years ago.
Addresses issue with require and zero length array

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by Kitson Kelly

Addresses issue with require and zero length array

comment:1 Changed 8 years ago by Rawld Gill

Resolution: fixed
Status: newclosed

In [27766]:

improved require to take a fast path if the dependency vector is empty; fixes #14724; !strict

comment:2 Changed 8 years ago by bill

Milestone: tbd1.8

No milestone specified, bulk update to 1.8.

comment:3 Changed 8 years ago by Rawld Gill

In [27839]:

backport #14724 fixes; refs #14724; !strict

comment:4 Changed 8 years ago by bill

Milestone: 1.81.7.2
Note: See TracTickets for help on using tickets.