<ul dir="auto">
<li>Electron version: 4.0.x</li>
<li>Operating system: Windows 7 &amp; macOS 10.14.2</li>
</ul>
<p dir="auto"><strong>Expected Behavior</strong><br>
The tray menu displays the same speed as normal.</p>
<p dir="auto"><strong>Actual behavior</strong><br>
Windows 7:<br>
It took almost a second to show up.<br>
Almost impossible to display when the number of menus increases.<br>
macOS 10.14.2:<br>
No difference from the normal menu. There is no problem.</p>
<p dir="auto"><strong>To Reproduce</strong><br>
<a href="https://github.com/orangeChu/multi-level-menu-for-tray.git">multi-level-menu-for-tray</a><br>
<a href="https://github.com/electron/electron/issues/16156" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/16156/hovercard">link issue#16156</a></p>
<p dir="auto">Also you can run with the following commands:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ git clone https://github.com/orangeChu/multi-level-menu-for-tray.git
$ cd multi-level-menu-for-tray
$ npm install
$ npm start || electron ."><pre class="notranslate">$ git clone https://github.com/orangeChu/multi-level-menu-for-tray.git
$ <span class="pl-c1">cd</span> multi-level-menu-for-tray
$ npm install
$ npm start <span class="pl-k">||</span> electron <span class="pl-c1">.</span></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/25950247/51219452-f7bc0400-196b-11e9-866f-9d5e91b06bc1.gif"><img src="https://user-images.githubusercontent.com/25950247/51219452-f7bc0400-196b-11e9-866f-9d5e91b06bc1.gif" alt="screen" data-animated-image="" style="max-width: 100%;"></a></p>
<ul dir="auto">
<li>electron@3.0.12(It also happens in 4.0.0)</li>
<li>win7 ultimate 64bit</li>
</ul>
<p dir="auto">Hi guys,<br>
When I try to create multi-level menu for tray-menu,it worked,but loading speed is too slow.</p>
<p dir="auto">Example code is below.<br>
main.js</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="'use strict';
const app = require('electron').app;
const Tray = require('electron').Tray;
const Menu = require('electron').Menu;
const path = require('path');

let tray;
let contextMenu;

class Test {
    constructor() {

    }

    initApp() {
        app.on('ready', () =&gt; {
            this.createTray();
        });
    }

    createTray() {
        tray = new Tray(path.join(__dirname, 'icon.png'));
        tray.setToolTip('Test');

        let childMenu = [];
        let submenu = [];
        let lastLv = [];

        for (let index = 0; index &lt; 5; index++) {
            lastLv.push({
                label: `lastLv${index}`
            });
        }

        for (let index = 0; index &lt; 10; index++) {
            childMenu.push({
                label: `childMenu${index}`,
                type: 'submenu',
                submenu: lastLv
            });
        }

        for (let index = 0; index &lt; 500; index++) {
            submenu.push({
                label: `menuItem${index}`,
                type: 'submenu',
                submenu: childMenu
            });
        }

        contextMenu = Menu.buildFromTemplate([{
            label: 'test',
            type: 'submenu',
            submenu
        }]);

        tray.on('right-click', () =&gt; {
            //It may be cost 2's or more
            tray.popUpContextMenu(contextMenu);
        });
    }
}

new Test().initApp();"><pre class="notranslate"><code class="notranslate">'use strict';
const app = require('electron').app;
const Tray = require('electron').Tray;
const Menu = require('electron').Menu;
const path = require('path');

let tray;
let contextMenu;

class Test {
    constructor() {

    }

    initApp() {
        app.on('ready', () =&gt; {
            this.createTray();
        });
    }

    createTray() {
        tray = new Tray(path.join(__dirname, 'icon.png'));
        tray.setToolTip('Test');

        let childMenu = [];
        let submenu = [];
        let lastLv = [];

        for (let index = 0; index &lt; 5; index++) {
            lastLv.push({
                label: `lastLv${index}`
            });
        }

        for (let index = 0; index &lt; 10; index++) {
            childMenu.push({
                label: `childMenu${index}`,
                type: 'submenu',
                submenu: lastLv
            });
        }

        for (let index = 0; index &lt; 500; index++) {
            submenu.push({
                label: `menuItem${index}`,
                type: 'submenu',
                submenu: childMenu
            });
        }

        contextMenu = Menu.buildFromTemplate([{
            label: 'test',
            type: 'submenu',
            submenu
        }]);

        tray.on('right-click', () =&gt; {
            //It may be cost 2's or more
            tray.popUpContextMenu(contextMenu);
        });
    }
}

new Test().initApp();
</code></pre></div>