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

Optimizing $.type() #1

Closed
wants to merge 1 commit into from
Closed

Conversation

willmoffat
Copy link

Hi,

I tried profiling scene.render() with 400 cubes. It looks like 20% of the time is spent inside $.type()
This commit reduces it to 2%.

Not exhaustively tested, but it does pass the unit tests ;-)

Nice work on PhiloGL!
--Will

I assume that any WebGL capable browser also supports isArray()
@philogb
Copy link
Contributor

philogb commented Mar 18, 2011

Thanks a lot for your fix :)

type looks like a much faster implementation now, but it does rely on constructor which is a writable property in any object. The previous check was checking directly for the [[Class]] value. (More info here) I'm not sure though I should be that strict; I'll try profiling different approaches on jsperf. I'll get back when the fix is pushed, thanks a lot again :)

@philogb
Copy link
Contributor

philogb commented Apr 3, 2011

Thanks again for the report. This commit:

e992b9c

Increases $.type performance of about 30-50% and still has a robust check based on [[Class]]. You can compare the implementations here. I hope this makes it useful :)

Thanks!

@philogb philogb closed this Apr 3, 2011
philogb added a commit that referenced this pull request Jul 31, 2011
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.

2 participants