Browse Source

[c#/beetlex] update (#6367)

* update beetlex 1.4.3

update beetlex 1.4.3

* docker add COMPlus_ReadyToRun variable
update beetlex

* update beetlex, enabled thread queue

* beetlex framework add db and queries cases

* add db code

* change result json data

* update query url

* beetlex framework add fortunes cases

* change Content-Type

* add beetlex core cases

* fix queries cases

* update config

* change try readline

* update benchmark config

* Update README.md

* Update README.md

* change versus property

* beetlex-core update .net core to v3.0

* change beetlex-core project file

* beetlex update raw db class

* beetlex update raw db

* beetlex debug plaintext

* change debug docker file

* update beetlex to 1.4.0

* update

* beetlex update core 3.1

* [c#/beetlex] add updates cases

* [c#/beetlex] change Server: TFB, change custom connection pool, add update docker

* fix errors

* change pool init

* change connection pool maxsize

* fix fortunes errors

* clear DBRaw _connectionString value.

* [c#beetlex] change update dbconnection pool size

* [c#/beetlex] udpate spanjson to v3.0.1, Npgsql v5.0.0

* [c#/beetlex] add caching sample

* set connectionstring multiplexing

* remove connection multiplexing setting

* [c#/beetlex]change NpgsqlParameter to  NpgsqlParameter<T>

* [c#/beetlex] update dbraw

* [c#/beetlex] change connection string

* [c#/beetlex]  add fortunes cases to core-updb

* update beetlex 1.5.6

* update 5.0.0-alpha1

* update docker file

* Enabled IOQueues

* Set IOQueues debug mode

* update

* [c#/beetlex] udpate to v1.6.0.1-beta

* update pg drive

* [c#/beetlex] update to beetlex v1.6.3 and support pipelining

* set options

* [c#/beetlex] Optimized actions

* [c#/beetlex] update plaintext

* Bump ServiceStack in /frameworks/CSharp/servicestack/src/SelfHost

Bumps [ServiceStack](https://github.com/ServiceStack/ServiceStack) from 3.9.59 to 5.9.2.
- [Release notes](https://github.com/ServiceStack/ServiceStack/releases)
- [Commits](https://github.com/ServiceStack/ServiceStack/commits/v5.9.2)

Signed-off-by: dependabot[bot] <[email protected]>

* [c#/beetlex] change plaintext buffer size, optimize fortunes.

* [c#/beetlex] update v1.6.5,use System.Text.Json

* change docker files

* update beetlex 1.6.5.2

* [c#/beetlex] update v1.6.5.3-beta

* [c#/beetlex] update 1.6.5.36-beta

* update

* update json

* [c#/beetlex] update

* update beetlex 1.6.5.38 beta

* update

* add  array buffer

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Henry 4 years ago
parent
commit
c5e56a398e

+ 32 - 11
frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs

@@ -53,6 +53,25 @@ namespace PlatformBenchmarks
 
         private Npgsql.NpgsqlParameter<int> mID;
 
+        private static int ListDefaultSize = 8;
+
+        private World[] mWorldBuffer = null;
+
+        private World[] GetWorldBuffer()
+        {
+            if (mWorldBuffer == null)
+                mWorldBuffer = new World[512];
+            return mWorldBuffer;
+        }
+
+        private Fortune[] mFortunesBuffer = null;
+
+        private Fortune[] GetFortuneBuffer()
+        {
+            if (mFortunesBuffer == null)
+                mFortunesBuffer = new Fortune[512];
+            return mFortunesBuffer;
+        }
 
         public async Task<World> LoadSingleQueryRow()
         {
@@ -80,7 +99,7 @@ namespace PlatformBenchmarks
             }
         }
 
-        public async Task<World[]> LoadMultipleQueriesRows(int count)
+        public async Task<ArraySegment<World>> LoadMultipleQueriesRows(int count)
         {
             using (var db = new NpgsqlConnection(_connectionString))
             {
@@ -145,24 +164,24 @@ namespace PlatformBenchmarks
         }
 
 
-        private async Task<World[]> LoadMultipleRows(int count, DbConnection db)
+        private async Task<ArraySegment<World>> LoadMultipleRows(int count, DbConnection db)
         {
             SingleCommand.Connection = db;
             SingleCommand.Parameters[0].Value = _random.Next(1, 10001);
-            var result = new World[count];
+            var result = GetWorldBuffer();
             for (int i = 0; i < result.Length; i++)
             {
                 result[i] = await ReadSingleRow(db, SingleCommand);
                 SingleCommand.Parameters[0].Value = _random.Next(1, 10001);
             }
-            return result;
+            return new ArraySegment<World>(result, 0, count);
 
         }
 
-        public async Task<List<Fortune>> LoadFortunesRows()
+        public async Task<ArraySegment<Fortune>> LoadFortunesRows()
         {
-            var result = new List<Fortune>();
-
+            int count = 0;
+            var result = GetFortuneBuffer();
             using (var db = new NpgsqlConnection(_connectionString))
             {
                 await db.OpenAsync();
@@ -171,17 +190,19 @@ namespace PlatformBenchmarks
                 {
                     while (await rdr.ReadAsync())
                     {
-                        result.Add(new Fortune
+                        result[count] = (new Fortune
                         {
                             Id = rdr.GetInt32(0),
                             Message = rdr.GetString(1)
                         });
+                        count++;
                     }
                 }
             }
-            result.Add(new Fortune { Message = "Additional fortune added at request time." });
-            result.Sort();
-            return result;
+            result[count] = (new Fortune { Message = "Additional fortune added at request time." });
+            count++;
+            Array.Sort<Fortune>(result, 0, count);
+            return new ArraySegment<Fortune>(result, 0, count);
         }
         public async Task<World[]> LoadMultipleUpdatesRows(int count)
         {

+ 1 - 1
frameworks/CSharp/beetlex/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -8,7 +8,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="BeetleX" Version="1.6.5.36-beta" />
+    <PackageReference Include="BeetleX" Version="1.6.5.38-beta" />
     <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="5.0.0" />
     <PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
     <PackageReference Include="Npgsql" Version="5.0.3" />

+ 1 - 1
frameworks/CSharp/beetlex/PlatformBenchmarks/queries.cs

@@ -31,7 +31,7 @@ namespace PlatformBenchmarks
             try
             {
                 var data = await token.Db.LoadMultipleQueriesRows(count);
-                System.Text.Json.JsonSerializer.Serialize<World[]>(GetUtf8JsonWriter(stream, token), data, SerializerOptions);
+                System.Text.Json.JsonSerializer.Serialize(GetUtf8JsonWriter(stream, token), data, SerializerOptions);
             }
             catch (Exception e_)
             {