Skip to content

Responsive rustdoc output is unresponsive (literally) #22325

Closed
@mahkoh

Description

@mahkoh

E.g. http://tomaka.github.io/cpal/alsa-sys/index.html

Resizing two windows that show this site causes 3-5 seconds of 100% cpu usage on two cores.

Solution: Remove responsive javascript to make the site more responsive.

    function resizeShortBlocks() {
        if (resizeTimeout) {
            clearTimeout(resizeTimeout);
        }
        resizeTimeout = setTimeout(function() {
            var contentWidth = $('.content').width();
            $('.docblock.short').width(function() {
                return contentWidth - 40 - $(this).prev().width();
            }).addClass('nowrap');
            $('.summary-column').width(function() {
                return contentWidth - 40 - $(this).prev().width();
            })
        }, 150);
    }
    resizeShortBlocks();
    $(window).on('resize', resizeShortBlocks);

But that's not all: When you load this site for the first time, it doesn't even react to any user input for 5 seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions