News for hackers. Stuff that matters.
Re:Programming language comparison by reimplementing the sam... by zigzag312 on Monday October 24, 2022 @04:08AM (#33314070)
Few tips to improve C# performance:

- enable source generation for JSON serialization

https://learn.microsoft.com/en-us/dotnet/standard/serializat...

- use `TryGetValue` to do single dictionary lookup instead of two.

  if (TripsIxByRoute.TryGetValue(route, out var tripIxs))
- specify List's capacity, if it's known when creating it, to avoid resizing operations while adding elements to the List

  var schedules = new List<StopTimeResponse>(stopTimeIxs.Count);

There are no comments on this comment yet.