Skip to content

Performance and Benchmarks #184

Closed
Closed
@jaredcnance

Description

@jaredcnance
  • 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();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions