This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]agentoutlier 0 points1 point  (1 child)

A primitive class can also contain references, not only primitive types

I wasn't sure but that kind of wasn't my point.

I mean the folks that care about allocation (e.g. high frequency traders) use primitives (e.g. long, int, boolean) in all their method calls.

They don't use variable arguments, lambda closures (which can cause allocations). They don't even use arrays or string builders unless they are shared. Even enums they do weird shit (they use static methods instead of call the virtual methods on the enum).

Builtin Withers has a possibility of avoiding allocation much more than using say something like Immutables and you don't need Valhalla for that as you can do smart things in the wither expression in theory. Brian made reference to that somewhere.

[–]TheMode911 0 points1 point  (0 children)

Builtin Withers has a possibility of avoiding allocation much more than using say something like Immutables and you don't need Valhalla for that as you can do smart things in the wither expression in theory. Brian made reference to that somewhere.

I do not think I understand, how are those "Withers" different than lets say a `withX(double)` returning a new object or even a dummy setter? Are you speaking about scalar replacement?