Skip to content
This repository has been archived by the owner on Jun 18, 2018. It is now read-only.

Remove lodash/memoize dependency #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KnutHelland
Copy link

@gaearon Whyyyy import another (big) module for memoizing two functions that basically are just constants (pure functions with no arguments)??

This is just picking, and I know you probably aren't actively maintaining this project. But since I stumbled upon it, and since I know you are into optimizing nowadays, I just wanted to mention it. 馃槂

I'm also very inspired of this one right now: nolanlawson.com The Cost of Small Modules Just think about how extremely much overhead you are putting on something that is basically just a constant value anyway 馃槷

@gaearon
Copy link
Member

gaearon commented Aug 18, 2016

Sure, sounds good. I鈥檒l leave it to @kesne to review/release.

/firefox/i.test(navigator.userAgent)
);
const _isSafari = Boolean(window.safari);
const _isFirefox = !_isSafari && /firefox/i.test(navigator.userAgent);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need the !_isSafari here?

Copy link
Author

Choose a reason for hiding this comment

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

No. It was stupid. For some reason I had the impression that this file was ment to be as optimized as possible, and I assumed that for all iOS-devices out there it would be a tiny bit faster to not have to execute that regex.

It could also be an idea to not use an regexp for this simple task at all:

const _isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;

Copy link
Collaborator

Choose a reason for hiding this comment

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

That also seems like a positive change to me.

Let's just guard these in checks so that this doesn't blow up server rendering!

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

Successfully merging this pull request may close these issues.

None yet

3 participants