I have an application in clojure making heavy use of a Java framework called Vaadin. Vaadin uses several callbacks using the Java "proxy" feature of clojure. However, every time a proxy is called in a clojure function there is a significant delay (100s of milliseconds sometimes). Is there any way I can speed this up?
My understanding is that the new reify macro is faster than proxy. You can use it if you only need to implement a single interface.
For example, if you need to implement a java.awt.event.ActionListener you can use code like the following:
(import 'java.awt.event.ActionListener 'javax.swing.JButton)
(let [a-button (JButton. "Click Me")]
(.addActionListener a-button
(reify ActionListener
(actionPerformed [this ev] (comment do something interesting)))))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With