在Clojure 1.3中使用transient时,存在什么问题? [英] What gotcha's exist when working with transient in Clojure 1.3?
本文介绍了在Clojure 1.3中使用transient时,存在什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找技术来加速我的应用程序,我正在尝试瞬态。我知道我应该谨慎对待他们,但是出现的问题是什么?
I'm looking into techniques to speed up my application and I'm trying out Transients. I know I'm supposed to treat them with some caution, but what are the kinds of issues that arise?
任何建议都会感激!
推荐答案
使用瞬态,像通常的持久数据结构 - 也就是说,总是使用来自mutator的返回值,而不是调用mutator的结构。但是,不要相信旧版本保持不变,不要从其他线程访问瞬态。
Use transients like the usual persistent data structures - that is, always use the return value from a mutator instead of the structure you called the mutator on. However, don't trust that the old version stays the same, and don't access transients from other threads.
这篇关于在Clojure 1.3中使用transient时,存在什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文