Skip to content

make a round of performance tuning #538

Closed

Description

@trusktr

There's things we can optimize, like preventing new variable creations, using typeof instead of instanceof, etc.

F.e. here's a test that shows instanceof being slower than typeof:

Activity

  1. self-assigned this
    on May 31, 2020
  2. dalisoft commented on May 31, 2020

    @dalisoft
    Member

    These benchmarks useless unless you have very low-end device, in 2020 thinking about ms isn't good idea, but i may be wrong.
    On my notebook with 2-core T2060 with 64Mb GPU memory - yes, it's matters, but gives at least 30FPS on some complex animations
    Now even phones even powerful than my old notebook, gives at least 45-50FPS which is enough.

    Microbenchmarks isn't good + there not a lot of developers which can spent their time to improve performance

    This comment is just my thought, sorry if i'm wrong

  3. trusktr commented on May 31, 2020

    @trusktr
    MemberAuthor

    Where it really matters is when animating a high number of things. Even if we can only improve performance by, say, 25%, then that's awesome because it means we can animated 2500 objects instead of 2000 (for example). The more performance, the better.

    Some people really do care about it, especially if they are making dynamic experiences like first person shooters or similar.

    But for the vast majority of use cases (for example, any website with an animation here or there) it probably does not matter.

    It's similar to React vs Backbone.js: sure, React is faster, but honestly for the majority of use cases Backbone.js with string-based Handlebars templating is perfectly fine and achieves the same thing (however you will definitely not make a performant first person shooter with it).

  4. dalisoft commented on Jun 1, 2020

    @dalisoft
    Member

    Yes, you right. I understand you. Thanks for reply.
    I really cared about performance always until got job, i learned on job on company: don’t waste time on not important things, so i just said my thought

  5. trusktr commented on Jun 3, 2020

    @trusktr
    MemberAuthor

    i learned on job on company: don’t waste time on not important things, so i just said my thought

    Hehe, true! Gotta weigh the values. (I'm planning to make a web based first person shooter later, so besides this I'd also like to compile Tween.js to WebAssembly. More on that later!)

  6. dalisoft commented on Jun 3, 2020

    @dalisoft
    Member

    Would be great to see tweenjs in WebAssembly :)
    Maybe AssemlyScript good choice?

  7. trusktr commented on Jun 3, 2020

    @trusktr
    MemberAuthor

    You read my mind! I just merged #544, which converts to TypeScript, and so next steps are to compile the TS with AS.

  8. trusktr commented on Jun 3, 2020

    @trusktr
    MemberAuthor

    From @mikebolt in #340,

    Objects and arrays have a larger footprint than basic types, even when they are empty. For this reason, we could have a 10-20% memory footprint reduction by removing the initialization of _chainedTweens and _valuesStartRepeat. Some refactoring would be required. _chainedTweens could initially be null, then set to an array when 'chain' is called.

  9. trusktr commented on Sep 23, 2026

    @trusktr
    MemberAuthor

    I will close this. It isn't a concrete idea.

    Any time is a good time for optimization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions