influxdata / influxdb-client-csharp

InfluxDB 2.x C# Client
https://influxdata.github.io/influxdb-client-csharp/api/InfluxDB.Client.html
MIT License
361 stars 92 forks source link

feat: Use IEnumerable in WriteApi to eliminate unnecessary memory allocations #606

Closed birdalicious closed 10 months ago

birdalicious commented 10 months ago

Proposed Changes

Change WriteApi to use IEnumerable for collection arguments instead of List. Change WriteRecords(List<string> records) to WriteRecords(IEnumerable<string> records)

Calling ToList on a collection will incur a memory allocation as the data is copied to the new list. Making the argument IEnumerable means ToList doesn't need to be called and so no extra memory allocation. Internally this will eliminate the unnecessary memory allocation in WriteRecords(string[] record) call to ToList, and client code also won't have to make the allocation if their data isn't already in a List## Checklist

Checklist

birdalicious commented 10 months ago

What do I need to run dotnet test I've installed all the versions of .NET required but what is the setup up for the influx instances on 8086/9999?

bednar commented 10 months ago

You can start pre-configured InfluxDB instances in a Docker environment using the /Scripts/influxdb-restart.sh script.

bednar commented 10 months ago

This PR has been closed because it has not had recent activity. Please reopen if this PR is still important to you and you want to continue with them.