Benchmark for the second patch: (setq v (with-current-buffer (find-file-noselect "~/emacs/test/src/json-tests.el") (vector (buffer-substring-no-properties (point-min) (point-max))))) (progn (garbage-collect) (benchmark-run-compiled 1000 (json-serialize v))) Results for the second patch: 0.7815s applied vs. 0.7962s without.