Hacker News new | past | comments | ask | show | jobs | submit login

Note that "short lived objects" and "stack allocated objects" aren't exactly the same set. Common Lisp has a dynamic-extent declaration, which can be used to stack allocate [1]. Go and Java implementations perform escape analysis. There can have some wins if stack allocatability is tracked at runtime, rather than compile-time [2]; Cliff Click reported roughly doubling the number of stack-allocated objects by using escape detection rather than analysis [3].

At least the Inkscape vector editor uses the Boehm garbage collector [4]. There are several programming language implementations which use Boehm and C, but one wonders if it is still a "C codebase" then.

[1] http://www.lispworks.com/documentation/HyperSpec/Body/d_dyna...

[2] Henry Baker, CONS should not CONS its arguments https://www.cs.tufts.edu/~nr/cs257/archive/henry-baker/cons-...

[3] https://youtu.be/5uljtqyBLxI?t=791

[4] http://inkscape.gitlab.io/inkscape/doxygen/namespaceInkscape...




Thankyou. I didn’t know about Inkscape, or anything about Common Lisp. Javascript (in V8) also has special detection & processing for very short lived objects. I appreciate the links!

But I was specifically responding to / confused by this claim in the GP comment:

> GC-based languages all ended up adding special syntax to add that level of control for objects when the programmer wants fine-grained control over the destructor. (Emphasis mine)

And as you say, Java, V8 and Go do this with heuristics, not syntax. And I’m not sure if Ruby or Python do this sort of escape / generational analysis at all. On the flip side, it looks like Lua has added something like this, and C# has stack-allocated structs.

Lua + C# + CommonLisp falls very short of the “all GC languages” claim.


> And I’m not sure if Ruby or Python do this sort of escape / generational analysis at all.

It would almost certainly be implementation specific (as it is with js really, v8 is not a langage).

I would assume pypy does escape analysis, I’m almost certain cpython does not.


Okay I have edited the post so it does not say "all".




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: