diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
index 92580593411763353fab24fbff7e2315f5ae0f27..ad7e272e9177f545a3da27dbd88495501d6d1751 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/FastROptions.java
@@ -59,6 +59,7 @@ public enum FastROptions {
     LoadPackagesNativeCode("Load native code of packages, including builtin packages.", !FastRConfig.ManagedMode),
     EmitTmpSource("Write deparsed source code to temporary files for better debugging.", true),
     EmitTmpDir("The directory where to allocate temporary files with deparsed source code.", null, true),
+    EmitTmpHashed("Use an SHA-256 hash as file name to reduce temporary file creation.", true),
 
     // Promises optimizations
     EagerEval("If enabled, overrides all other EagerEval switches (see EagerEvalHelper)", false),
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java
index 147efcf77dfda0218cff71451cb7c7d3ba1a3b6f..05e90e6a62562fca6e94c85d6b6740d8c8b5f517 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java
@@ -11,16 +11,22 @@
  */
 package com.oracle.truffle.r.runtime;
 
+import static java.nio.file.StandardOpenOption.CREATE_NEW;
+import static java.nio.file.StandardOpenOption.WRITE;
+
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.StandardOpenOption;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 
+import javax.xml.bind.DatatypeConverter;
+
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.interop.TruffleObject;
 import com.oracle.truffle.api.object.DynamicObject;
@@ -321,19 +327,43 @@ public class RDeparse {
             }
         }
 
+        private static Path tmpDir = null;
+        private static MessageDigest digest = null;
+
+        private Path emitToFile() throws IOException, NoSuchAlgorithmException {
+            Path path;
+            if (FastROptions.EmitTmpHashed.getBooleanValue()) {
+                if (tmpDir == null) {
+                    tmpDir = Files.createTempDirectory("deparse");
+                }
+                if (digest == null) {
+                    digest = MessageDigest.getInstance("SHA-256");
+                }
+                String printHexBinary = DatatypeConverter.printHexBinary(digest.digest(sb.toString().getBytes()));
+                path = tmpDir.resolve(printHexBinary + ".r");
+            } else {
+                path = Files.createTempFile("deparse-", ".r");
+            }
+            if (!Files.exists(path)) {
+                try (BufferedWriter bw = Files.newBufferedWriter(path, CREATE_NEW, WRITE)) {
+                    bw.write(sb.toString());
+                }
+            }
+            return path;
+        }
+
         public void fixupSources() {
             if (FastROptions.EmitTmpSource.getBooleanValue()) {
                 try {
-                    Path path = Files.createTempFile("deparse-", ".r");
-                    try (BufferedWriter bw = Files.newBufferedWriter(path, StandardOpenOption.WRITE)) {
-                        bw.write(sb.toString());
-                    }
+                    Path path = emitToFile();
                     Source source = RSource.fromFile(path.toFile());
                     for (SourceSectionElement s : sources) {
                         s.element.setSourceSection(source.createSection(s.start, s.length));
                     }
                 } catch (IOException e) {
                     RInternalError.reportError(e);
+                } catch (NoSuchAlgorithmException e) {
+                    throw RInternalError.shouldNotReachHere("SHA-256 is an unknown algorithm");
                 }
             } else {
                 Source source = RSource.fromTextInternal(sb.toString(), RSource.Internal.DEPARSE);