Created
September 22, 2012 17:12
-
-
Save llibra/3766833 to your computer and use it in GitHub Desktop.
URI encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; do-urlencodeはUTF-8に変換してる分不利 | |
;; ただ、1MBの処理に1GB超は少し辛い? | |
;; 実際にそんな大きいデータを扱うことはないけど、積み重なると結構差が出そう | |
(let ((str (map 'string (lambda (_) | |
(declare (ignore _)) | |
(code-char (random 255))) | |
(make-string (* 1024 1024))))) | |
(null (time (puri::encode-escaped-encoding str puri::*reserved-characters* t))) | |
(null (time (urlencode:urlencode str)))) | |
; (PURI::ENCODE-ESCAPED-ENCODING STR PURI::*RESERVED-CHARACTERS* T) | |
; took 196,152 microseconds (0.196152 seconds) to run. | |
; 133,789 microseconds (0.133789 seconds, 68.21%) of which was spent in GC. | |
; During that period, and with 2 available CPU cores, | |
; 163,975 microseconds (0.163975 seconds) were spent in user mode | |
; 30,995 microseconds (0.030995 seconds) were spent in system mode | |
; 18,647,856 bytes of memory allocated. | |
; 92 minor page faults, 0 major page faults, 0 swaps. | |
; (DO-URLENCODE:URLENCODE STR) | |
; took 7,321,979 microseconds (7.321979 seconds) to run. | |
; 1,371,124 microseconds (1.371124 seconds, 18.73%) of which was spent in GC. | |
; During that period, and with 2 available CPU cores, | |
; 7,280,893 microseconds (7.280893 seconds) were spent in user mode | |
; 0 microseconds (0.000000 seconds) were spent in system mode | |
; 1,178,938,384 bytes of memory allocated. | |
; 22 minor page faults, 1 major page faults, 0 swaps. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment