Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
leftist heap
Feb 28, 2013

Fun Shoe
p sure java converts ALL string concats to string builder anyway

code:
public class StringTest {

	public String strTest(String a, String b) {
		return a + b;
	}
}
code:
  public java.lang.String strTest(java.lang.String a, java.lang.String b);
     0 new java.lang.StringBuilder [16]
     3  dup
     4  aload_1 [a]
     5  invokestatic java.lang.String.valueOf(java.lang.Object) : java.lang.String [18]
     8  invokespecial java.lang.StringBuilder(java.lang.String) [24]
    11  aload_2 [b]
    12  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [27]
    15  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [31]
    18  areturn
you want to use a string builder if you're doing the concatenation in a loop though because otherwise you will get new string builders in every iteration.

Adbot
ADBOT LOVES YOU

oh no blimp issue
Feb 23, 2011

gently caress programming is complicated

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

rrrrrrrrrrrt posted:

p sure java converts ALL string concats to string builder anyway

code:
public class StringTest {

	public String strTest(String a, String b) {
		return a + b;
	}
}
code:
  public java.lang.String strTest(java.lang.String a, java.lang.String b);
     0 new java.lang.StringBuilder [16]
     3  dup
     4  aload_1 [a]
     5  invokestatic java.lang.String.valueOf(java.lang.Object) : java.lang.String [18]
     8  invokespecial java.lang.StringBuilder(java.lang.String) [24]
    11  aload_2 [b]
    12  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [27]
    15  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [31]
    18  areturn
you want to use a string builder if you're doing the concatenation in a loop though because otherwise you will get new string builders in every iteration.

yeah, but I bet the JVM knows an awful lot about that pattern and optimizes it aggressively to avoid the SB allocation; don't care quite enough to look into the OpenJDK sources though.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

rrrrrrrrrrrt posted:

eclipse is fine but definitely needs some janitoring.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
i am pretty sure it does, but probably only in a second-tier mode

once upon a time javac did some simple static optimizations and the jit team bitched that it was making their analysis more difficult or actually inhibiting perfect optimization — which to be fair is easy to imagine for some transformations, like merging local variables — and so they changed javac to be blindingly stupid. that string builder transform is actually dictated by the language spec, otherwise they probably wouldn't do it

i don't know if they've revisited that decision, there is plenty of good research into what early optimizations do and do not inhibit later dynamic optimization

Forums Terrorist
Dec 8, 2011

fwiw i was joking, i definitely don't do anything of importance with java

CPColin
Sep 9, 2003

Big ol' smile.
If you use + with two or more string literals, the compiler will combine them all into a single literal, which is nice. It'll even helpfully inline constants from other classes for you, making your "do I need a clean build" decisions nice and easy!

Edit: I wrote a dumb article about this, last time it came up. It's unpopular!

CPColin fucked around with this message at 21:36 on Apr 6, 2015

Valeyard
Mar 30, 2012


Grimey Drawer

Awia posted:

gently caress programming is complicated

brap
Aug 23, 2004

Grimey Drawer
.net does this poo poo apparently http://stackoverflow.com/questions/20029868/understanding-of-net-internal-stringbuildercache-class-configuration

Valeyard
Mar 30, 2012


Grimey Drawer
a month out from our exams and the lecturer of the functional programming class sent out an email just now saying the exam (worth 80% of the class) will be multiple choice :psyduck: epic fail

oh no blimp issue
Feb 23, 2011

Valeyard posted:

a month out from our exams and the lecturer of the functional programming class sent out an email just now saying the exam (worth 80% of the class) will be multiple choice :psyduck: epic fail

i wish my functional programming exam was multiple choice!

Valeyard
Mar 30, 2012


Grimey Drawer

Awia posted:

i wish my functional programming exam was multiple choice!

but with a traditional paper i could write a partially correct solution and get some of the marks

with this, its all or nothing. and its negatively marked so a wrong solution is going to be detrimental compared to actually helpful

oh no blimp issue
Feb 23, 2011

Valeyard posted:

but with a traditional paper i could write a partially correct solution and get some of the marks

with this, its all or nothing. and its negatively marked so a wrong solution is going to be detrimental compared to actually helpful

oh well that sucks, negatively marked exams are dumb

my exam is like 75% on python for some reason

Valeyard
Mar 30, 2012


Grimey Drawer

Awia posted:

oh well that sucks, negatively marked exams are dumb

my exam is like 75% on python for some reason

when is your last exam and what are the plans after graduation?

Shaggar
Apr 26, 2006

Forums Terrorist posted:

fwiw i was joking, i definitely don't do anything of importance with java

oh so you use c#, then.

triple sulk
Sep 17, 2014



c# owns

suffix
Jul 27, 2013

Wheeee!

Valeyard posted:

a month out from our exams and the lecturer of the functional programming class sent out an email just now saying the exam (worth 80% of the class) will be multiple choice :psyduck: epic fail

score! you'll ace it! :peanut:

oh no blimp issue
Feb 23, 2011

Valeyard posted:

when is your last exam and what are the plans after graduation?

dissertation in for the 28th, exams some time early May.
I've got a place on a graduate scheme atm starting in September but ive got other interviews that are looking for a mid May start, so ill see what happens

what about you?

Bloody
Mar 3, 2013

Share Bear
Apr 27, 2004

intellij is fine and faster than eclipse out of the box

the vim input plugin kinda fucks up a often though

eclipse also throws a lot of poo poo at you right out of the box which you probably don't want or need and cannot disable, which i think is the main difference but thats 6 months in on java

Forums Terrorist
Dec 8, 2011

Shaggar posted:

oh so you use c#, then.

i wish, i get to struggle through decade old java assignments instead

i don't actually know if the programming faculty even know c# exists

triple sulk
Sep 17, 2014



Shaggar
Apr 26, 2006
mechanically separate all non-tab users.

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i use 1 space indentation

DimpledChad
May 14, 2002
Rigging elections since '87.
i write only manually minified javascript

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

fart simpson posted:

i use 1 space indentation

:vd:



i don't even like two-space; my eyes are old and weak :corsair:

jesus WEP
Oct 17, 2004


lol if you gaf about how you janitor ur indentation instead of letting visual studio 2013 do it for you

kitten emergency
Jan 13, 2008

get meow this wack-ass crystal prison

Shaggar posted:

mechanically separate all non-tab users.

shaggar was right

Valeyard
Mar 30, 2012


Grimey Drawer

Awia posted:

dissertation in for the 28th, exams some time early May.
I've got a place on a graduate scheme atm starting in September but ive got other interviews that are looking for a mid May start, so ill see what happens

what about you?

sounds like a plan, ill race you to the end. dissertation was handed in already, bunch of exams finishing mid May, and then starting on a grad scheme in september

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

prefect posted:

:vd:



i don't even like two-space; my eyes are old and weak :corsair:

actually i use 4 spaces

oh no blimp issue
Feb 23, 2011

Valeyard posted:

sounds like a plan, ill race you to the end. dissertation was handed in already, bunch of exams finishing mid May, and then starting on a grad scheme in september

cool! grad scheme interesting?

Notorious b.s.d.
Jan 25, 2003

by Reene

i just do whatever my coworkers are doing

i give no fucks

Valeyard
Mar 30, 2012


Grimey Drawer

Awia posted:

cool! grad scheme interesting?

an investment bank. so no interesting work but :10bux:

oh no blimp issue
Feb 23, 2011

Valeyard posted:

an investment bank. so no interesting work but :10bux:

the :10bux: is the most important part

Asshole Masonanie
Oct 27, 2009

by vyelkin
i make my editors convert spaces to tabs first thing when i open a file

Soricidus
Oct 21, 2010
freedom-hating statist shill

Notorious b.s.d. posted:

i just do whatever my coworkers are doing

i give no fucks

bsd was right

jony neuemonic
Nov 13, 2009

Notorious b.s.d. posted:

i just do whatever my coworkers are doing

i give no fucks

Bloody
Mar 3, 2013

gg=G

Bloody
Mar 3, 2013

lol as though I ever open poo poo written by anybody else

Adbot
ADBOT LOVES YOU

bobbilljim
May 29, 2013

this christmas feels like the very first christmas to me
:shittydog::shittydog::shittydog:

  • Locked thread