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

Replace StringBuffer with StringBuilder in IoUtil and TemplateUtil #823

Closed
rohanKanojia opened this issue Aug 4, 2021 · 16 comments · Fixed by #897
Closed

Replace StringBuffer with StringBuilder in IoUtil and TemplateUtil #823

rohanKanojia opened this issue Aug 4, 2021 · 16 comments · Fixed by #897
Assignees
Labels
first-timers-only Is this your first time contributing? This could be a good place to start! good first issue Good for newcomers

Comments

@rohanKanojia
Copy link
Member

Description

Early classes of the Java API, such as Vector, Hashtable and StringBuffer, were synchronized to make them thread-safe. Unfortunately, synchronization has a big negative impact on performance, even when using these collections from a single thread.

We should use unsynchronized update these places to use StringBuilder instead:
https://github.com/eclipse/jkube/blob/b25157bcafb4a9b6b738a0fce018fc3803e6b78e/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/util/IoUtil.java#L141

https://github.com/eclipse/jkube/blob/b25157bcafb4a9b6b738a0fce018fc3803e6b78e/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/util/TemplateUtil.java#L28

How to manually test my changes

Kubernetes

If you don't have a real Kubernetes cluster available (most probably), you can use Minikube or Kind to test with a local cluster.

OpenShift

If you don't have a real OpenShift cluster available (most probably), you can use Red Hat's developer Sandbox for Red Hat OpenShift. The only requirement is to have a Red Hat account.

Once you have your Sandbox environment, you'll need to download the oc tool from the cluster console.
(Press the ? icon and from the context menu select Command line tools, you'll be redirected to https://$subdomain.openshiftapps.com/command-lines-tools where you'll be able to download the CLI for your platform)

@rohanKanojia rohanKanojia added good first issue Good for newcomers first-timers-only Is this your first time contributing? This could be a good place to start! labels Aug 4, 2021
@Ash-KODES
Copy link

i am ready to work on the issue

@Onyinye91-ctrl
Copy link
Contributor

Hello @Ash-KODES Is this issue still available? if yes, i will love to work on it

@rohanKanojia
Copy link
Member Author

@Onyinye91-ctrl : Hi, Could you please check if you can work on #854 instead?

@Onyinye91-ctrl
Copy link
Contributor

@rohanKanojia Just checked it out. Can i go for it?

@rohanKanojia
Copy link
Member Author

@Onyinye91-ctrl : Yes, Could you please add a comment on the issue so that I can assign it to you?

@Onyinye91-ctrl
Copy link
Contributor

@rohanKanojia I have already done that

@rohanKanojia
Copy link
Member Author

Sorry for not being clear, I meant to comment on #854 . I can only assign users participating in specific issue conversations.

@tejassinghsital
Copy link

@rohanKanojia Greetings Sir, Sir I am looking for some simple issues that I can work on as my first ever contribution to open source. I''ve been actively looking for some beginner level issues but almost all are assigned already to others. I am little confused now so can you please put me in right direction? Really looking for your reply...

@rohanKanojia
Copy link
Member Author

@Ash-KODES : polite ping, Are you still working on this issue? If not, Is it okay if I assign this to @tejassinghsital ?

@tejassinghsital : Thanks for showing interest in contributing to our project. Let me create some more good first issues by the end of today.

@Hell4U
Copy link
Contributor

Hell4U commented Sep 2, 2021

Hey, @rohanKanojia I am new to contributing. Can I get some simple issue for my way to first ever contribution to open source ? Since most of the first-timers-only issue were solved when I was finding them.

@manusa
Copy link
Member

manusa commented Sep 2, 2021

Hey, @rohanKanojia I am new to contributing. Can I get some simple issue for my way to first ever contribution to open source ? Since most of the first-timers-only issue were solved when I was finding them.

https://github.com/eclipse/jkube/labels/first-timers-only

We tend to add new issues here every day, or when there are no more available.

@Ash-KODES
Copy link

@Ash-KODES : polite ping, Are you still working on this issue? If not, Is it okay if I assign this to @tejassinghsital ?

@tejassinghsital : Thanks for showing interest in contributing to our project. Let me create some more good first issues by the end of today.

yes go ahead

@rohanKanojia rohanKanojia assigned Hell4U and unassigned Ash-KODES Sep 2, 2021
@Hell4U
Copy link
Contributor

Hell4U commented Sep 2, 2021

So, I am just curious do I have to down mention below to this particular jkube/jkube-kit/common/src/main/java/org/eclipse/jkube/kit/common/util/IoUtil.java file or all the files present in project.

- StringBuffer ret = new StringBuffer("["); 
+ StringBuffer answer = new StringBuffer(); 

@rohanKanojia
Copy link
Member Author

This issue is only applicable to two files mentioned in issue description.

@Hell4U
Copy link
Contributor

Hell4U commented Sep 2, 2021

Thanks for clearing the doubt.

Hell4U added a commit to Hell4U/jkube that referenced this issue Sep 9, 2021
@ronnuriel
Copy link

is this issue still open ?

Hell4U added a commit to Hell4U/jkube that referenced this issue Sep 22, 2021
Signed-off-by: Hell4U <18BCE131@nirmauni.ac.in>
Signed off the footer.
manusa pushed a commit that referenced this issue Sep 27, 2021
* Fixed #823 replaced `StringBuffer` with `StringBuilder` in 2 files.

* Updated the StringBuffer method to StringBuilder(#823)

* Updated the StringBuffer method to StringBuilder(#823)

Signed-off-by: Hell4U <18BCE131@nirmauni.ac.in>
Signed off the footer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-timers-only Is this your first time contributing? This could be a good place to start! good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants