Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String performance #252

Closed

Conversation

TobiasWallner
Copy link
Contributor

I did not delete any functions or methods (I state that because 'git diff' markes some as deleted but it just did not realise that they only changed lines). I only added functions that unlike the old ones do not create new std::strings but write into an existing one that can be pre-allocated.

This may also be beneficial to the issue #186 improve the rendering performance by avoiding calls to malloc.

Furthermore I added the variable names 'row' and 'column' to the cursor constructor so that the programmer can quickly see from a look into the header (or the IDEs pop up) which argument belongs to which dimension.

Copy link
Collaborator

@certik certik left a comment

Choose a reason for hiding this comment

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

I think that's fine. Thanks for the PR! We can also later just use the new method and remove the old methods.

@MCWertGaming can you please also review & merge?

@certik certik requested a review from MCWertGaming May 19, 2023 16:19
@flagarde
Copy link
Collaborator

@TobiasWallner @certik Nice additions but I would vote to keep the old ones too because it seems it would be impossible to do :

Term::terminal<<cursor_right(2); 

which I think could be useful

@MCWertGaming
Copy link
Collaborator

Hey! Thank you for the contributions. I have sadly trouble with the CI right now as they are not starting. @certik could it be possible that we have reached a resource limit of some kind? I'll look into reviewing and fixing the CI (if needed for this PR) when the CI runs again.

@certik
Copy link
Collaborator

certik commented May 23, 2023

I am not aware of any limits. Sometimes GitHub Actions don't work, so we can try tomorrow again.

@MCWertGaming
Copy link
Collaborator

I am not aware of any limits. Sometimes GitHub Actions don't work, so we can try tomorrow again.

I just wondered because https://www.githubstatus.com is not showing any problems. But I'll review it tomorrow then, no worries ^^

@MCWertGaming
Copy link
Collaborator

Alright, the CI just started working again, but it seems like there are a few issues with the STL includes. I'll look into fixing them tomorrow then.

TobiasWallner and others added 6 commits May 24, 2023 15:25
…ng a typo that leads to a bug due to special character for example that are multiple symbols in the string but only one byte long
… the chance of an human error. Additionally added functions that write to an existing string for the color functions
@TobiasWallner
Copy link
Contributor Author

TobiasWallner commented May 24, 2023

I noticed a dumb mistake by me I had made in the code I wanted to push with this pull request.
In some of the outputString referenced where I use the .append( "some string" , int size) function of the std::string I gave a wrong number of the size for the string.

In my fork I have fixed this by changeing it to .append( "some string" , sizeof("some string")-1). The mistake came from miscounting special characters that start with '\' in the string.

Furthermore I went with the same idea to write in existing strings in addition to createing new ones through color.hpp and color.cpp.

I guess it would be probably best to reject this pull request and make a new one?

@TobiasWallner
Copy link
Contributor Author

TobiasWallner commented May 24, 2023

I have to give my appologies for the many accidental contributions.
I was unaware that github will automatically create pull requests to this repo from my fork as soon as I push something from my machine.

I will try to deactivate this, because it is confuseing and makes this pull request unnecessary complicated.
Sry again.

@certik
Copy link
Collaborator

certik commented May 24, 2023

A good git practice is that you don't push into the string_performance branch that you used to create the PR. Push into a different branch, then it won't appear here.

@MCWertGaming
Copy link
Collaborator

It's also possible to use "cherry pick" to move a specific commit from one branch into another, so that the PR branch keeps being clean ^^ I'll close this PR then for now. We would be really greatful when you would take your time and prepare a new PR @TobiasWallner. Tell us if you need help with anything.

@TobiasWallner
Copy link
Contributor Author

It's also possible to use "cherry pick" to move a specific commit from one branch into another, so that the PR branch keeps being clean ^^ I'll close this PR then for now. We would be really greatful when you would take your time and prepare a new PR @TobiasWallner. Tell us if you need help with anything.

I will try, thank you for the motivateing words. Background if interrested: I am doing a university project and part of that includes makeing a GUI. Your library looked very cool and so I decided to make my project completelly in the terminal using your codebase.

@MCWertGaming
Copy link
Collaborator

Background if interested: I am doing a university project and part of that includes making a GUI. Your library looked very cool and so I decided to make my project completely in the terminal using your code-base.

That sounds really cool! I personally am using this library for playing around with game prototypes and doing a few smaller CLI tools for myself ^^
It's really nice to see what people create with this library. it might be a nice thing to add a small list of repos / projects that are using cpp-terminal to get a better view to what's actually created with this library and where we might be able to help a bit out on.

I hope it works out for your project. If you need anything, feel free to open Issues and just ask away. The library is currently in heavy WIP, so there will be a few changes, I hope that we can get into a proper API design soon to make a final V1 release and then proceed with additional modifications on V2 separately so that updates on the API doesn't affect all projects that use this libraries.

@TobiasWallner TobiasWallner deleted the string_performance branch June 7, 2023 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants