<ul dir="auto">
<li><strong>Electron Version</strong> (output of <code class="notranslate">node_modules/.bin/electron --version</code>): 4.0.x also in 3.x.x or older</li>
<li><strong>Operating System</strong> (Platform and Version): Windows 7 &amp; Windows 10</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">The tray menu displays the same speed as normal.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">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>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto"><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><br>
<a href="https://github.com/electron/electron/issues/16413" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/16413/hovercard">link issue#16413</a></p>
<h3 dir="auto">Screenshots</h3>
<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>
<h3 dir="auto">Additional Information</h3>
<p dir="auto">In issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="399600688" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/16413" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/16413/hovercard" href="https://github.com/electron/electron/issues/16413">#16413</a>, codebytere is said to be a limitation of the Windows platform, but I use the <a href="https://github.com/weolar/miniblink49"><code class="notranslate">miniblink</code></a> (more compact, which implements most of the electron functions) to create a tray menu that loads the multi-level menu at a different speed than the normal menu. . So I want to re-create a new problem for loading multi-level menus.<br>
<a href="https://github.com/electron/electron/files/2860844/demo.zip">demo(with miniblink).zip</a><br>
Can you please re-emphasize this issue? Thanks.</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/codebytere/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/codebytere">@codebytere</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/MarshallOfSound/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/MarshallOfSound">@MarshallOfSound</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/zcbenz/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/zcbenz">@zcbenz</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>