Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

[c#/beetlex] update - #6367

Merged
NateBrady23 merged 105 commits into
TechEmpower:masterfrom
beetlex-io:master
Feb 18, 2021
Merged

NateBrady23 merged 105 commits into
TechEmpower:masterfrom
beetlex-io:master

Conversation

@beetlex-io

Copy link
Copy Markdown
Contributor

[c#/beetlex] update

beetlex-io and others added 23 commits December 8, 2020 21:08
…harp/servicestack/src/SelfHost/ServiceStack-5.9.2'
public async Task<List<Fortune>> LoadFortunesRows()
{
var result = new List<Fortune>();
var result = new List<Fortune>(20);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this. The data structure must be dynamically sized according to the test rules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify the initial size of the list to reduce the memory copy problem caused by insufficient capacity. Other frameworks initialize the list in this way。

java\wizzardo

public void fortunes() {
       response.async();
       dbService.getClient().preparedQuery("SELECT * FROM fortune", res -> {
           try {
               if (res.succeeded()) {
                   PgRowSet result = res.result();
                   ArrayList<Fortune> fortunes = new ArrayList<>(result.size() + 1);
                   for (Row row : result) {
                       fortunes.add(new Fortune(row.getInteger(0), row.getString(1)));
                   }

                   fortunes.add(new Fortune(0, "Additional fortune added at request time."));
                   fortunes.sort(Comparator.comparing(fortune -> fortune.message));

                   model().append("fortunes", fortunes);
                   response.setBody(renderView("fortunes").renderReadableData());
                   response.appendHeader(Header.KV_CONTENT_TYPE_HTML_UTF8);
               } else {
                   res.cause().printStackTrace();
                   response.status(Status._500).body(res.cause().getMessage());
               }

               commitAsyncResponse();
           } catch (Exception e) {
               e.printStackTrace();
           }
       });
   }

aspnetcore\PlatformBenchmarks

        public async Task<List<Fortune>> LoadFortunesRows()
        {
            var result = new List<Fortune>(20);

            using (var db = new NpgsqlConnection(_connectionString))
            {
                await db.OpenAsync();

                using (var cmd = new NpgsqlCommand("SELECT id, message FROM fortune", db))
                using (var rdr = await cmd.ExecuteReaderAsync())
                {
                    while (await rdr.ReadAsync())
                    {
                        result.Add(new Fortune
                        (
                            id:rdr.GetInt32(0),
                            message: rdr.GetString(1)
                        ));
                    }
                }
            }

            result.Add(new Fortune(id: 0, message: "Additional fortune added at request time." ));
            result.Sort();

            return result;
        }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those frameworks need to be fixed. Thank you for pointing it out.

public async Task<List<Fortune>> LoadFortunesRows()
{
var result = new List<Fortune>(20);
var result = new List<Fortune>(ListDefaultSize);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this is not acceptable. Please remove this. You can fix the other two you pointed out in this PR if you'd like, or I can get to them tomorrow. It was missed.

The list data structure must be a dynamic-size or equivalent and should not be dimensioned using foreknowledge of the row-count of the database table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I use Array buffer, dynamically-sized returned ArraySegment?

@NateBrady23
NateBrady23 merged commit c5e56a3 into TechEmpower:master Feb 18, 2021
andreasrueb pushed a commit to digitallyinduced/IHP-FrameworkBenchmarks that referenced this pull request Apr 13, 2021
* 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants