Giter VIP home page Giter VIP logo

Comments (5)

ghempton avatar ghempton commented on September 15, 2024

My guess is that this is due to merging all of the children in. One way to make this way faster an avoid unnecessary merges is to pass a rev property down from the server (this could be as simple as serializing the updated_at column into a timestamp if you are using rails). By default, epf will check this property and know if it already has seen this version.

If you don't pass this property, epf always assumes all the data contains updates and performs a merge algorithm against it.

Let me know how it goes, cheers!

from epf.

ghempton avatar ghempton commented on September 15, 2024

Btw, some perf tests like those would be great to have in epf itself, would much appreciate a PR if you get this resolved.

from epf.

stas-sl avatar stas-sl commented on September 15, 2024

Thanks, you are right, adding rev to the mock data speeded up the test 10x times from 20s to 2s.

adapter.r['GET:/posts'] = posts: [{id: 1, comments: [1..100], rev: 1}],
comments: ({id: num, post: 1, rev: 1} for num in [1..100])
rest
    post with 100 comments
      ✓ fresh load works relatively fast (345ms)
      ✓ load if post and comments already in session is very slow (19712ms)
      ✓ load if post and comments already in session with rev specified (2140ms)

Though it is already quite acceptable time, I'm wondering if you know other 'secrets' to speed up it a bit more :)

I can try to make a PR, but not sure what is correct way to implement performance tests. Is it ok to measure execution time in test? Or just check that data is correct as it is already done?

from epf.

ghempton avatar ghempton commented on September 15, 2024

Being as we don't have any perf tests yet, I'm fine with any mechanism. It could be enough to simply have the test present, but if there was some way to get the execution time inside and after hook and warn if it changes above a threshold that would be a step up.

No other big low-hanging perf tricks that I can think of off the top of my head. In our app in extremely perf sensitive areas (e.g. rendering lists of hundreds of items) we generally just load the raw json (you can do this by passing serialize: false) and then manually merge in the data using session.mergeData when we need it. In these areas we also do the rendering manually instead of using ember's normal template bindings (by overriding the render method to render a raw handlebars template).

from epf.

stas-sl avatar stas-sl commented on September 15, 2024

Thanks for the tips, I'll keep in mind them.

from epf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.