Skip to content

Performance and Benchmarks #184

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

Closed
jaredcnance opened this issue Nov 9, 2017 · 0 comments
Closed

Performance and Benchmarks #184

jaredcnance opened this issue Nov 9, 2017 · 0 comments

Comments

@jaredcnance
Copy link
Contributor

jaredcnance commented Nov 9, 2017

  • profile the examples apps to determine hot paths
  • setup a benchmarkdotnet project
  • write benchmarks for known hot paths
  • optimize based on benchmarks

Known Issues:

public class Identifiable<T> : IIdentifiable<T> where T : Guid {
  // ...
}
  • Use BaseController instead of Controller
  • Use .AsNoTracking() on read-only queries
  • Use .Attach(/*..*/) instead of first calling GetAsync(/*..*/) in PATCH requests
    public virtual async Task<TEntity> UpdateAsync(TId id, TEntity entity)
    {
    var oldEntity = await GetAsync(id);
    if (oldEntity == null)
    return null;
    foreach (var attr in _jsonApiContext.AttributesToUpdate)
    attr.Key.SetValue(oldEntity, attr.Value);
    foreach (var relationship in _jsonApiContext.RelationshipsToUpdate)
    relationship.Key.SetValue(oldEntity, relationship.Value);
    await _context.SaveChangesAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant