-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
Sending a tar file (~25MB) in the request body took around ~7sec, while it was near instant in the curl process.
Further investigation revealed that the bottleneck is process-send-region
Creating a temporary buffer and passing the location of that to curl reduced the execution time drastically.
What I am doing looks like this.
@@ -888,7 +888,11 @@
collect (format "%s: %s" k v))
(list "--url" url)
(when data
- (split-string "--data-binary @-"))
+ (let ((file (make-temp-file "request-")))
+ (with-temp-file file
+ (set-buffer-file-coding-system 'raw-text)
+ (insert data))
+ (list "--data-binary" (concat "@" file))))
(cl-loop with stdin-p = data
for (name . item) in files
collect "--form"
@@ -988,7 +992,7 @@
(set-process-coding-system proc 'no-conversion 'no-conversion)
(set-process-query-on-exit-flag proc nil)
(process-send-string proc stdin-config)
- (when (or data file-buffer file-data)
+ (when (or file-buffer file-data)
;; We dynamic-let the global `buffer-file-coding-system' to `no-conversion'
;; in case the user-configured `encoding' doesn't fly.
;; If we do not dynamic-let the global, `select-safe-coding-system' would
Would you like me to create a pull request with a similar change applied to files parameter as well?
I understand if you do not want to modify an already working code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels