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.
 
  • Post
  • Reply
sarehu
Apr 20, 2007

(call/cc call/cc)
I remember one time thinking I was so clever at my last job making a data structure like that, it ended up being 100% useless.

It's adds needless data structure overhead and usually some needless conditional checking on every access too, the people suffering under some performance problem are going to want to be able to solve their problems, not suffer under them because their code is checking the structure of the string one widechar at a time.

Adbot
ADBOT LOVES YOU

Workaday Wizard
Oct 23, 2009

by Pragmatica
hey erlang ppl

would i be doing myself a disservice by jumping into elixir without learning erlang?

Cybernetic Vermin
Apr 18, 2005

you are optimizing precisely one case here: avoiding a constant overheard on code that manages to make a lot of calls to charAt in such a way that hotspot does not manage to figure out that all calls past the first are monomorphic (in that they are now used on a realized, flat, string), and to preserve performance in this one case you suggest forcing all cases of concatenating strings to be hand-optimized using a secondary builder class (and it is up to the programmer to then ensure that they thread the builder through all code that may keep making concatenations, avoiding realizing it too early)

the prior case should be fantastically less common than the latter, not least because you really should use codePointAt to actually deal with full unicode these days (a method which involves several branches in itself, trivially masking the overhead of checking the layout of the string)

i mean, again, it is hardly important, and in a general sense you are right that one should avoid scattered data structures trying to optimize stuff beforehand, but this is specifically for java.lang.String, and inspecting that precise type, going through all the ways you can use it, it is actually really hard to make a case against lazy concatenations

sarehu
Apr 20, 2007

(call/cc call/cc)
Actually it's really easy to make the case for not having lazy concatenations, you should pay the cost where you code does the concatenation. You need to have the performance of your code be as simple to understand as possible. You also are making more work for the JIT, preventing it from doing something else. Code that relies on it has more GC overhead. It's bad ideas all around and doesn't solve any real problem with the world.

MononcQc
May 29, 2007

Shinku ABOOKEN posted:

hey erlang ppl

would i be doing myself a disservice by jumping into elixir without learning erlang?

Not really. You'll know when you'll be forced back into learning Erlang for a bunch of stuff. Most Elixir people I see these days are only interested in replacing Rails with Phoenix and frankly that web stuff is so isolated from the rest of the language when 90% of the stuff you do is live within the framework and database there's not that much needed from the language itself, much less from the underlying one (Erlang).

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
the lfe people send me sw8 stickers a million years ago when i had a spasm of interest in working in lfe and on lfetool and i've accomplished nothing since and don't even bother to lurk in the irc channel any more ;_;

aardvaard
Mar 4, 2013

you belong in the bog of eternal stench

MononcQc posted:

Not really. You'll know when you'll be forced back into learning Erlang for a bunch of stuff. Most Elixir people I see these days are only interested in replacing Rails with Phoenix and frankly that web stuff is so isolated from the rest of the language when 90% of the stuff you do is live within the framework and database there's not that much needed from the language itself, much less from the underlying one (Erlang).

How is Phoenix compared to other p-lang web frameworks?

MononcQc
May 29, 2007

CommunistPancake posted:

How is Phoenix compared to other p-lang web frameworks?

it's a match for the family, but isn't as dog slow as most of them would be.

Shaggar
Apr 26, 2006
why would you ever use a plang let alone for web development? just use asp.net

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
aspie.net

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Max Facetime
Apr 18, 2009

Notorious b.s.d. posted:

a public field is a direct reference to the data. a user outside the defining class is writing directly to memory. the implementation can't change without also changing all calling code

well... sorta but not quite...

you could ship your updated class and include with it instruction-level transformations that can replace old style accesses in calling methods with the correct instructions needed for accessing the field after your change

e.g. if one 32-bit field was replaced with 2 32-bit fields then a transformation would need to add an extra local variable inside a caller to accommodate the additional data. a bit tricky perhaps, but doable :D

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Shinku ABOOKEN posted:

hey erlang ppl

would i be doing myself a disservice by jumping into elixir without learning erlang?

nah. the only semantic difference really is that elixir has variables that can be updated and if you want to match against them you have to use the pin operator. erlang has unification, not variable assignment

you might want to learn erlang tho because most of the good otp documentation uses erlang for examples and a lot of the tooling you'll want to use is much better in erlang than in elixir

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





CommunistPancake posted:

How is Phoenix compared to other p-lang web frameworks?

it's like an evolution of rails. which is ok i guess but there are more interesting things going on in web frameworks than MVC, CRUD and ORMs

Soricidus
Oct 21, 2010
freedom-hating statist shill

the talent deficit posted:

it's like an evolution of rails. which is ok i guess but there are more interesting things going on in web frameworks than MVC, CRUD and ORMs

they're all still crud, op

brap
Aug 23, 2004

Grimey Drawer
more like object relational mayhem!!!

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



fleshweasel posted:

more like object relational mayhem!!!

cowboy beepboop
Feb 24, 2001

the talent deficit posted:

it's like an evolution of rails. which is ok i guess but there are more interesting things going on in web frameworks than MVC, CRUD and ORMs

like what

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Exploring ways to open security holes more efficiently through **convention**.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture






graphql, crdts shared between clients and servers, flux, state transformations, ...

distortion park
Apr 25, 2011


PSA: keep your nodejs comments short. They effect performance.

https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e

distortion park
Apr 25, 2011


Making that sort of optimisation would make me feel really clever until someone pointed out how stupid it was to even exist in the first place.

qntm
Jun 17, 2009
And here's where that setting is controlled. So apparently there are slightly more sensible heuristics (number of AST nodes) kicking around too...

Bloody
Mar 3, 2013

pointsofdata posted:

PSA: keep your nodejs comments short. They effect performance.

https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e

lmao

cowboy beepboop
Feb 24, 2001

pointsofdata posted:

PSA: keep your nodejs comments short. They effect performance.

https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e

too close to the metal

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
the real hosed up thing is having comments in the function body rather than as a docblock above

Shaggar
Apr 26, 2006

pointsofdata posted:

PSA: keep your nodejs comments short. They effect performance.

https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e

lmao

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

pointsofdata posted:

PSA: keep your nodejs comments short. They effect performance.

https://top.fse.guru/nodejs-a-quick-optimization-advice-7353b820c92e

affect

Soricidus
Oct 21, 2010
freedom-hating statist shill
defect

Soricidus
Oct 21, 2010
freedom-hating statist shill
infect

tef
May 30, 2004

-> some l-system crap ->
https://eval.in/451711

rubby

code:
SCOPE = "outer"

module A
  FOO = nil
  SCOPE = "inner"
  
  module B
    puts A::FOO::SCOPE # inner
  end
end

puts A::FOO::SCOPE # outer

module A
  module B
    puts SCOPE # inner
  end
end
    
module A::B
  puts SCOPE # outer
end

MononcQc
May 29, 2007


:suicide:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

tef posted:

https://eval.in/451711

rubby

code:
SCOPE = "outer"

module A
  FOO = nil
  SCOPE = "inner"
  
  module B
    puts A::FOO::SCOPE # inner
  end
end

puts A::FOO::SCOPE # outer

module A
  module B
    puts SCOPE # inner
  end
end
    
module A::B
  puts SCOPE # outer
end

how

Stringent
Dec 22, 2004


image text goes here

:cripes:

tef
May 30, 2004

-> some l-system crap ->

nil turns a lookup into a lexical lookup.

code:
A = "butt"
module Butt
  B = nil
  puts B::A
end
:: is a deeply mysterious operator.

n.b you can't emulate this by doing Butt::nil::A, as that produces an exception for an undefined method nil during constant lookup on the object Butt, but you can do this by doing nil::A, or ::A

with the other one, module A::B and module A, module B are different. the first one will look up in A::B, the second will lookup in A::B and A

tef
May 30, 2004

-> some l-system crap ->

every single feature rubyists tout as being magical, the quirks that make it pleasant to write a dsl for your boilerplate, and the shorthand that lets your example fit neatly on a slide, well, they have a downside.

code:
if nil
  puts "nil"
elif true
  puts "true"
else
  puts "else"
end
yes of course this prints else.

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
loving nil every time

tef
May 30, 2004

-> some l-system crap ->

have you ever truly inherited a util *function*. i don't mean one of those enormous 10,000 line modules with 197 different functions wrapping the standard library, i mean a single 10,000 line function. the sort of code where they've truly avoided implementing anything twice, and frankly the code re-use is astonishing. the sort of thing where the code is written from today's usecase down through all twelve intermingled switch statements.

a large proportion of ruby was designed by taking a simple language and adding edge cases to it.

tef
May 30, 2004

-> some l-system crap ->

Symbolic Butt posted:

loving nil every time

change the `if nil` to `if true` and you'll get an exception.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
javascript has nothing on ruby for footguns

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply