首页> 外文期刊>Science of Computer Programming >Safe automated refactoring for intelligent parallelization of Java 8 streams
【24h】

Safe automated refactoring for intelligent parallelization of Java 8 streams

机译:java 8流的智能并行化安全自动重构

获取原文
获取原文并翻译 | 示例

摘要

Streaming APIs are becoming more pervasive in mainstream Object-Oriented programming languages and platforms. For example, the Stream API introduced in Java 8 allows for functional-like, MapReduce-style operations in processing both finite, e.g., collections, and infinite data structures. However, using this API efficiently involves subtle considerations such as determining when it is best for stream operations to run in parallel, when running operations in parallel can be less efficient, and when it is safe to run in parallel due to possible lambda expression side-effects. In this paper, we present an automated refactoring approach that assists developers in writing efficient stream code in a semantics-preserving fashion. The approach, based on a novel data ordering and typestate analysis, consists of preconditions and transformations for automatically determining when it is safe and possibly advantageous to convert sequential streams to parallel and unorder or de-parallelize already parallel streams. The approach was implemented as a plug-in to the popular Eclipse IDE, uses the WALA and SAFE analysis frameworks, and was evaluated on 18 Java projects consisting of ~1.65M lines of code. We found that 116 of 419 candidate streams (27.68%) were refactorable, and an average speedup of 3.49 on performance tests was observed. The results indicate that the approach is useful in optimizing stream code to their full potential.
机译:流媒体API在主流面向对象的编程语言和平台中变得更加普遍。例如,在Java 8中引入的流API允许在处理有限,例如集合和无限数据结构的过程中使用类似的MapReduce操作。然而,使用该API有效地涉及微妙的注意事项,例如确定它最佳的流操作何时并行运行,当并行运行时可以较低,并且由于可能的Lambda表达侧,安全运行并行运行时效果。在本文中,我们提出了一种自动重构方法,帮助开发人员以语义保存的方式编写高效的流代码。该方法基于新颖的数据排序和类型分析,包括用于自动确定何时安全且可能有利于将顺序流转换为并行的和未顺题的何处的先决条件和转换,或者是有利的。该方法被实施为流行的Eclipse IDE插件,使用沃拉和安全分析框架,并在18个由〜1.65米代码行组成的18个Java项目中进行评估。我们发现,419个候选物流(27.68%)的116个是重构的,并且观察到3.49的平均加速度。结果表明,该方法可用于优化流代码至其全部潜力。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号