Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memoize isAsarDisabled because it's called a lot #7948

Closed
wants to merge 1 commit into from
Closed

Conversation

anaisbetts
Copy link
Contributor

image

I suspect that on Windows, calling into process.env is not a very snappy operation

if (process.noAsar) {
asarDisabled = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

process.noAsar is allowed to be changed at runtime so it shouldn't be cached.

return true
}

asarDisabled = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be set to false if it gets here?

@kevinsawicki kevinsawicki changed the title Memoize isAsarDisabled because it's called a LOT Memoize isAsarDisabled because it's called a lot Nov 14, 2016
if (process.noAsar) {
asarDisabled = true
return true
}
if (process.env.ELECTRON_NO_ASAR && process.type !== 'browser' && process.type !== 'renderer') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just memoize this instead above this method?

const envNoAsar = process.env.ELECTRON_NO_ASAR && process.type !== 'browser' && process.type !== 'renderer'

Then this method could just be

return process.noAsar || envNoAsar

@kevinsawicki
Copy link
Contributor

Thanks for profiling this, definitely would like to get this fixed and out this week in the next release, 1.4.7, left a few minor comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants