> Do the framework you're talking about do static analysis of the types? 
Because generic types are erased at runtime, so there wouldn't ever be a 
way for proxy to set them in.

They aren't entirely erased. They're erased from the code, but Java 
compilers are obligated to emit generic type signatures (as metadata) in 
the compiled class file.

The frameworks I mentioned reflect on these generic type parameters *at 
runtime* to drive their dynamic behavior. 

More information here:

https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getGenericSuperclass--
https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1

Searching back through this group, I found that in 2012 someone proposed a 
patch to Clojure supporting this in `proxy` (link: 
https://groups.google.com/d/msg/clojure/Xv1pKATfP0c/od_uwpHlNhMJ) but it 
looks like it never made it in.


On Saturday, June 22, 2019 at 11:32:36 PM UTC-5, Didier wrote:
>
> > They did cite a significant performance boost as a side effect.
>
> I think it isn't very clear from the wording. They didn't just rewrite it 
> in Java, they also changed the architecture:
>
> > Storm 2.0.0 introduces a new core featuring a leaner threading model, a 
> blazing fast messaging subsystem and a lightweight back pressure model
>
> So it is hard I think to do an apples to apples comparison. In my opinion, 
> a system like Storm will fundamentally be more limited by its architecture 
> in performance than the language it uses.
>
> That said, even if I think the performance improvements are probably 
> mostly due to architectural changes they also made. It shouldn't come as a 
> surprise that Java would be faster than Clojure in most cases. I don't want 
> to make false pretenses. Clojure and Java are not equal in semantics, and 
> Java's mutable, eager and object grouped methods semantics are almost 
> always going to be more performant. Clojure makes a trade offs of 
> performance and memory for simplicity.
>
> When people say Clojure can match Java in performance, it almost always 
> implies using escape hatches and changing the semantics back to imperative 
> code. The good news though, when you use Clojure's semantics, you benefit 
> in simplicity and the performance impact is marginal, so it is still fast 
> enough for almost all use cases.
>
> Now, back to type annotations. I really don't think Storm 2.0 performance 
> improvements were due to usage of reflection that hadn't been addressed 
> from Clojure. But who knows.
>
> Do the framework you're talking about do static analysis of the types? 
> Because generic types are erased at runtime, so there wouldn't ever be a 
> way for proxy to set them in.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/1cf5ad80-0504-4634-b186-b624206c0145%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to